Fix NETTY-432 HttpContentEncoder should not encode if Content-Encoding is set already and it is not 'identity'

This commit is contained in:
Trustin Lee 2011-10-22 22:08:49 -07:00
parent a67cdaeb48
commit e3386736c0

View File

@ -96,6 +96,12 @@ public abstract class HttpContentEncoder extends SimpleChannelHandler {
encoder = null;
String contentEncoding = m.getHeader(HttpHeaders.Names.CONTENT_ENCODING);
if (contentEncoding != null &&
!HttpHeaders.Values.IDENTITY.equalsIgnoreCase(contentEncoding)) {
// Content-Encoding is set already and it is not 'identity'.
ctx.sendDownstream(e);
} else {
// Determine the content encoding.
String acceptEncoding = acceptEncodingQueue.poll();
if (acceptEncoding == null) {
@ -128,6 +134,7 @@ public abstract class HttpContentEncoder extends SimpleChannelHandler {
// Because HttpMessage is a mutable object, we can simply forward the write request.
ctx.sendDownstream(e);
}
} else if (msg instanceof HttpChunk) {
HttpChunk c = (HttpChunk) msg;
ChannelBuffer content = c.getContent();