}
// Process the content length and transfer encodings
StreamSourceConduit conduit = new StreamSourceChannelWrappingConduit(channel);
long contentLength = -1;
if(noContent) {
conduit = new EmptyStreamSourceConduit(channel.getIoThread());
} else {
String transferEncoding = Headers.IDENTITY.toString();
if (headers.contains(Headers.TRANSFER_ENCODING)) {
transferEncoding = headers.getLast(Headers.TRANSFER_ENCODING);
} else if (http11 && ! headers.contains(Headers.CONTENT_LENGTH)) {
transferEncoding = Headers.CHUNKED.toString();
}
if (! transferEncoding.equals(Headers.IDENTITY.toString())) {
conduit = new ChunkedStreamSourceConduit(conduit, channel, connection.getBufferPool(), getFinishListener(closeConnection), request);
} else if (headers.contains(Headers.CONTENT_LENGTH)) {
contentLength = Long.parseLong(headers.getFirst(Headers.CONTENT_LENGTH));
if(contentLength == 0L) {
conduit = new EmptyStreamSourceConduit(channel.getIoThread());
noContent = true;
} else {
conduit = new FixedLengthStreamSourceConduit(conduit, contentLength, getFinishListener(closeConnection));
}
} else {