HttpContentEncoder should not remove Content-Length when acting as a passthrough.

This commit is contained in:
Jeff Pinner 2013-07-10 11:16:29 -07:00 committed by Norman Maurer
parent 2adf393277
commit cf9ee928b0

View File

@ -123,15 +123,13 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpReque
// If unable to encode, pass through.
if (result == null) {
if (isFull) {
// As an unchunked response
// Set the content length.
res.headers().remove(Names.TRANSFER_ENCODING);
res.headers().set(Names.CONTENT_LENGTH, ((ByteBufHolder) res).content().readableBytes());
out.add(ReferenceCountUtil.retain(res));
} else {
// As a chunked response
res.headers().remove(Names.CONTENT_LENGTH);
res.headers().set(Names.TRANSFER_ENCODING, Values.CHUNKED);
out.add(res);
// Pass through all following contents.
state = State.PASS_THROUGH;
}
break;