[#769] Do not set 'Content-Encoding' if the target encoding is 'identity'

This commit is contained in:
Norman Maurer 2013-01-02 16:16:49 +01:00
parent 725a54d07a
commit d183c1b24a

View File

@ -79,9 +79,14 @@ public abstract class HttpContentDecoder extends SimpleChannelUpstreamHandler
if (hasContent && (decoder = newContentDecoder(contentEncoding)) != null) {
// Decode the content and remove or replace the existing headers
// so that the message looks like a decoded message.
m.setHeader(
HttpHeaders.Names.CONTENT_ENCODING,
getTargetContentEncoding(contentEncoding));
String targetContentEncoding = getTargetContentEncoding(contentEncoding);
if (HttpHeaders.Values.IDENTITY.equals(targetContentEncoding)) {
// Do NOT set the 'Content-Encoding' header if the target encoding is 'identity'
// as per: http://tools.ietf.org/html/rfc2616#section-14.11
m.removeHeader(HttpHeaders.Names.CONTENT_ENCODING);
} else {
m.setHeader(HttpHeaders.Names.CONTENT_ENCODING, targetContentEncoding);
}
if (!m.isChunked()) {
ChannelBuffer content = m.getContent();