diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHttpOutputInterceptor.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHttpOutputInterceptor.java index 64e4b4a3af5..dacc476447a 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHttpOutputInterceptor.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHttpOutputInterceptor.java @@ -348,9 +348,11 @@ public class GzipHttpOutputInterceptor implements HttpOutput.Interceptor BufferUtil.compact(_buffer); int off=_buffer.arrayOffset()+_buffer.limit(); int len=_buffer.capacity()-_buffer.limit() - (_last?8:0); - int produced=_deflater.deflate(_buffer.array(),off,len,Deflater.NO_FLUSH); - - _buffer.limit(_buffer.limit()+produced); + if (len>0) + { + int produced=_deflater.deflate(_buffer.array(),off,len,Deflater.NO_FLUSH); + _buffer.limit(_buffer.limit()+produced); + } boolean finished=_deflater.finished(); if (finished)