diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java index 21ae185cab7..d39a0f220d7 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpReceiverOverHTTP.java @@ -80,6 +80,8 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res { if (buffer==null) throw new IllegalStateException(); + if (BufferUtil.hasContent(buffer)) + throw new IllegalStateException(); HttpClient client = getHttpDestination().getHttpClient(); ByteBufferPool bufferPool = client.getByteBufferPool(); bufferPool.release(buffer); @@ -133,6 +135,7 @@ public class HttpReceiverOverHTTP extends HttpReceiver implements HttpParser.Res { if (LOG.isDebugEnabled()) LOG.debug(x); + BufferUtil.clear(buffer); releaseBuffer(); failAndClose(x); }