Fix a bug where HttpContents are freed too early

This commit is contained in:
Trustin Lee 2013-01-17 00:50:43 +09:00
parent 4ee11cd36f
commit e95d3de1ff

View File

@ -158,6 +158,7 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
CompositeByteBuf content = (CompositeByteBuf) currentMessage.data();
if (content.readableBytes() > maxContentLength - chunk.data().readableBytes()) {
chunk.free();
// TODO: Respond with 413 Request Entity Too Large
// and discard the traffic or close the connection.
// No need to notify the upstream handlers - just log.
@ -208,6 +209,11 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
}
}
@Override
protected void freeInboundMessage(HttpObject msg) throws Exception {
// decode() frees HttpContents.
}
@Override
public void beforeAdd(ChannelHandlerContext ctx) throws Exception {
this.ctx = ctx;