diff --git a/handler/src/main/java/io/netty/handler/stream/ChunkedStream.java b/handler/src/main/java/io/netty/handler/stream/ChunkedStream.java index e50d4fbc57..65bef1df4d 100644 --- a/handler/src/main/java/io/netty/handler/stream/ChunkedStream.java +++ b/handler/src/main/java/io/netty/handler/stream/ChunkedStream.java @@ -38,6 +38,7 @@ public class ChunkedStream implements ChunkedInput { private final PushbackInputStream in; private final int chunkSize; private long offset; + private boolean closed; /** * Creates a new instance that fetches data from the specified stream. @@ -79,6 +80,10 @@ public class ChunkedStream implements ChunkedInput { @Override public boolean isEndOfInput() throws Exception { + if (closed) { + return true; + } + int b = in.read(); if (b < 0) { return true; @@ -90,6 +95,7 @@ public class ChunkedStream implements ChunkedInput { @Override public void close() throws Exception { + closed = true; in.close(); }