[#1201] Correctly handle mix of not compressed and compressed requests

This commit is contained in:
Norman Maurer 2013-03-25 08:12:48 +01:00
parent 8057c699cd
commit f76e38592d
2 changed files with 13 additions and 0 deletions

View File

@ -115,12 +115,19 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<HttpObj
return decoded; return decoded;
} }
if (c instanceof LastHttpContent) {
decodeStarted = false;
}
return new Object[] { message, c.retain() }; return new Object[] { message, c.retain() };
} }
if (decoder != null) { if (decoder != null) {
return decodeContent(null, c); return decodeContent(null, c);
} else { } else {
if (c instanceof LastHttpContent) {
decodeStarted = false;
}
return c.retain(); return c.retain();
} }
} }
@ -213,6 +220,7 @@ public abstract class HttpContentDecoder extends MessageToMessageDecoder<HttpObj
if (decoder.finish()) { if (decoder.finish()) {
fetchDecoderOutput(out); fetchDecoderOutput(out);
} }
decodeStarted = false;
decoder = null; decoder = null;
} }

View File

@ -143,6 +143,7 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpMessa
if (result == null) { if (result == null) {
if (c instanceof LastHttpContent) { if (c instanceof LastHttpContent) {
encodeStarted = false;
return new Object[] { message, new DefaultLastHttpContent(c.data().retain()) }; return new Object[] { message, new DefaultLastHttpContent(c.data().retain()) };
} else { } else {
return new Object[] { message, new DefaultHttpContent(c.data().retain()) }; return new Object[] { message, new DefaultHttpContent(c.data().retain()) };
@ -176,6 +177,10 @@ public abstract class HttpContentEncoder extends MessageToMessageCodec<HttpMessa
return encodeContent(null, c); return encodeContent(null, c);
} }
if (c instanceof LastHttpContent) {
encodeStarted = false;
}
return c.retain(); return c.retain();
} }
return null; return null;