diff options
3 files changed, 6 insertions, 5 deletions
diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/AsyncGzipFilter.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/AsyncGzipFilter.java index d4737b3515..2cdeb9c60c 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/AsyncGzipFilter.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/AsyncGzipFilter.java @@ -129,6 +129,7 @@ public class AsyncGzipFilter extends UserAgentFilter implements GzipFactory private static final Logger LOG = Log.getLogger(GzipFilter.class); public final static String GZIP = "gzip"; public static final String DEFLATE = "deflate"; + public final static String ETAG_GZIP="--gzip"; public final static String ETAG = "o.e.j.s.GzipFilter.ETag"; public final static int DEFAULT_MIN_GZIP_SIZE=256; @@ -363,9 +364,8 @@ public class AsyncGzipFilter extends UserAgentFilter implements GzipFactory String etag = request.getHeader("If-None-Match"); if (etag!=null) { - int dd=etag.indexOf("--"); - if (dd>0) - request.setAttribute(ETAG,etag.substring(0,dd)+(etag.endsWith("\"")?"\"":"")); + if (etag.contains(ETAG_GZIP)) + request.setAttribute(ETAG,etag.replace(ETAG_GZIP,"")); } HttpChannel<?> channel = HttpChannel.getCurrentHttpChannel(); diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/AbstractCompressedStream.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/AbstractCompressedStream.java index 6808c439e8..fc5b8bf978 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/AbstractCompressedStream.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/AbstractCompressedStream.java @@ -255,7 +255,7 @@ public abstract class AbstractCompressedStream extends ServletOutputStream String etag=_wrapper.getETag(); if (etag!=null) - setHeader("ETag",etag.substring(0,etag.length()-1)+'-'+_encoding+'"'); + setHeader("ETag",etag.substring(0,etag.length()-1)+"--"+_encoding+'"'); return; } } diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java index 3bbbb6bc7c..d56b2e55f5 100644 --- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java +++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java @@ -31,6 +31,7 @@ import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.HttpChannel; import org.eclipse.jetty.server.HttpOutput; import org.eclipse.jetty.server.Response; +import org.eclipse.jetty.servlets.AsyncGzipFilter; import org.eclipse.jetty.util.BufferUtil; import org.eclipse.jetty.util.Callback; import org.eclipse.jetty.util.IteratingNestedCallback; @@ -195,7 +196,7 @@ public class GzipHttpOutput extends HttpOutput response.setContentLength(-1); String etag=fields.get(HttpHeader.ETAG); if (etag!=null) - fields.put(HttpHeader.ETAG,etag.substring(0,etag.length()-1)+"--gzip\""); + fields.put(HttpHeader.ETAG,etag.substring(0,etag.length()-1)+AsyncGzipFilter.ETAG_GZIP+ '"'); LOG.debug("{} compressing {}",this,_deflater); _state.set(GZState.COMPRESSING); |