diff --git a/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AsyncMiddleManServlet.java b/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AsyncMiddleManServlet.java index 0bee62ac665..7c9f5150b90 100644 --- a/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AsyncMiddleManServlet.java +++ b/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AsyncMiddleManServlet.java @@ -226,14 +226,18 @@ public class AsyncMiddleManServlet extends AbstractProxyServlet while (input.isReady() && !input.isFinished()) { int read = readClientRequestContent(input, buffer); + if (_log.isDebugEnabled()) _log.debug("{} asynchronous read {} bytes on {}", getRequestId(clientRequest), read, input); + if (read<0) + return Action.SUCCEEDED; + if (contentLength > 0 && read > 0) length += read; ByteBuffer content = read > 0 ? ByteBuffer.wrap(buffer, 0, read) : BufferUtil.EMPTY_BUFFER; - boolean finished = read < 0 || length == contentLength; + boolean finished = length == contentLength; process(content, this, finished); if (read > 0)