Fix NETTY-432 HttpContentEncoder should not encode if Content-Encoding is set already and it is not 'identity'
This commit is contained in:
parent
a67cdaeb48
commit
e3386736c0
@ -96,6 +96,12 @@ public abstract class HttpContentEncoder extends SimpleChannelHandler {
|
|||||||
|
|
||||||
encoder = null;
|
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.
|
// Determine the content encoding.
|
||||||
String acceptEncoding = acceptEncodingQueue.poll();
|
String acceptEncoding = acceptEncodingQueue.poll();
|
||||||
if (acceptEncoding == null) {
|
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.
|
// Because HttpMessage is a mutable object, we can simply forward the write request.
|
||||||
ctx.sendDownstream(e);
|
ctx.sendDownstream(e);
|
||||||
|
}
|
||||||
} else if (msg instanceof HttpChunk) {
|
} else if (msg instanceof HttpChunk) {
|
||||||
HttpChunk c = (HttpChunk) msg;
|
HttpChunk c = (HttpChunk) msg;
|
||||||
ChannelBuffer content = c.getContent();
|
ChannelBuffer content = c.getContent();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user