diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java index c79a0ed627..bb39f9c1b4 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpObjectDecoder.java @@ -402,6 +402,11 @@ public abstract class HttpObjectDecoder extends ByteToMessageDecoder { protected void decodeLast(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { super.decodeLast(ctx, in, out); + if (resetRequested) { + // If a reset was requested by decodeLast() we need to do it now otherwise we may produce a + // LastHttpContent while there was already one. + resetNow(); + } // Handle the last unfinished message. if (message != null) { boolean chunked = HttpHeaders.isTransferEncodingChunked(message);