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 e4eb3c7e04b..451916c535f 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 @@ -204,8 +204,13 @@ public class GzipHttpOutputInterceptor implements HttpOutput.Interceptor _channel.getResponse().setContentLength(-1); String etag=fields.get(HttpHeader.ETAG); if (etag!=null) - fields.put(HttpHeader.ETAG,etag.substring(0,etag.length()-1)+GzipHandler.ETAG_GZIP+ '"'); - + { + int end = etag.length()-1; + etag=(etag.charAt(end)=='"')?etag.substring(0,end)+GzipHandler.ETAG_GZIP+'"':etag+GzipHandler.ETAG_GZIP; + fields.put(HttpHeader.ETAG,etag); + } + + LOG.debug("{} compressing {}",this,_deflater); _state.set(GZState.COMPRESSING);