[#1007] Make sure the current message is only reset on LastHttpContent

This commit is contained in:
Norman Maurer 2013-05-09 20:11:34 +02:00
parent 268b059ebb
commit c8de4f03f1
2 changed files with 6 additions and 1 deletions

View File

@ -153,7 +153,9 @@ public class HttpObjectAggregator extends MessageToMessageDecoder<HttpObject> {
assert currentMessage != null;
if (tooLongFrameFound) {
this.currentMessage = null;
if (msg instanceof LastHttpContent) {
this.currentMessage = null;
}
// already detect the too long frame so just discard the content
return;
}

View File

@ -111,6 +111,7 @@ public class HttpObjectAggregatorTest {
HttpContent chunk1 = new DefaultHttpContent(Unpooled.copiedBuffer("test", CharsetUtil.US_ASCII));
HttpContent chunk2 = new DefaultHttpContent(Unpooled.copiedBuffer("test2", CharsetUtil.US_ASCII));
HttpContent chunk3 = new DefaultHttpContent(Unpooled.copiedBuffer("test3", CharsetUtil.US_ASCII));
HttpContent chunk4 = LastHttpContent.EMPTY_LAST_CONTENT;
assertFalse(embedder.writeInbound(message));
assertFalse(embedder.writeInbound(chunk1.copy()));
@ -121,6 +122,7 @@ public class HttpObjectAggregatorTest {
// expected
}
assertFalse(embedder.writeInbound(chunk3.copy()));
assertFalse(embedder.writeInbound(chunk4.copy()));
assertFalse(embedder.writeInbound(message));
assertFalse(embedder.writeInbound(chunk1.copy()));
@ -131,6 +133,7 @@ public class HttpObjectAggregatorTest {
// expected
}
assertFalse(embedder.writeInbound(chunk3.copy()));
assertFalse(embedder.writeInbound(chunk4.copy()));
}
@Test(expected = IllegalArgumentException.class)