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 25ec321f59f..a758275e597 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 @@ -53,6 +53,8 @@ import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.CountingCallback; import org.eclipse.jetty.util.IteratingCallback; import org.eclipse.jetty.util.component.Destroyable; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /** *

Servlet 3.1 asynchronous proxy servlet with capability @@ -757,6 +759,8 @@ public class AsyncMiddleManServlet extends AbstractProxyServlet public static class GZIPContentTransformer implements ContentTransformer { + private static final Logger logger = Log.getLogger(GZIPContentTransformer.class); + private final List buffers = new ArrayList<>(2); private final ContentDecoder decoder = new GZIPContentDecoder(); private final ContentTransformer transformer; @@ -780,6 +784,9 @@ public class AsyncMiddleManServlet extends AbstractProxyServlet @Override public void transform(ByteBuffer input, boolean finished, List output) throws IOException { + if (logger.isDebugEnabled()) + logger.debug("Ungzipping {} bytes, finished={}", input.remaining(), finished); + if (!input.hasRemaining()) { if (finished) @@ -790,8 +797,11 @@ public class AsyncMiddleManServlet extends AbstractProxyServlet while (input.hasRemaining()) { ByteBuffer decoded = decoder.decode(input); - if (decoded.hasRemaining()) - transformer.transform(decoded, finished && !input.hasRemaining(), buffers); + boolean complete = finished && !input.hasRemaining(); + if (logger.isDebugEnabled()) + logger.debug("Ungzipped {} bytes, complete={}", decoded.remaining(), complete); + if (decoded.hasRemaining() || complete) + transformer.transform(decoded, complete, buffers); } }