diff options
author | Greg Wilkins | 2015-09-18 02:30:02 +0000 |
---|---|---|
committer | Greg Wilkins | 2015-09-18 02:30:02 +0000 |
commit | 99f4ed7352504072753e14615fe0e3471a00824b (patch) | |
tree | 03d60adef1959bbfee2254675a22044fee0a6a14 /jetty-server/src/main/java | |
parent | d39677a6359e9e768b35cff7957227ea14b8bb7a (diff) | |
download | org.eclipse.jetty.project-99f4ed7352504072753e14615fe0e3471a00824b.tar.gz org.eclipse.jetty.project-99f4ed7352504072753e14615fe0e3471a00824b.tar.xz org.eclipse.jetty.project-99f4ed7352504072753e14615fe0e3471a00824b.zip |
477737 Improve handling of etags with dynamic and static gzip
Diffstat (limited to 'jetty-server/src/main/java')
-rw-r--r-- | jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java index 1c0198bd19..688ed4cebc 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHandler.java @@ -18,6 +18,8 @@ package org.eclipse.jetty.server.handler.gzip; +import static org.eclipse.jetty.http.GzipHttpContent.ETAG_GZIP_QUOTE; + import java.io.File; import java.io.IOException; import java.util.Set; @@ -62,7 +64,6 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory public final static String GZIP = "gzip"; public final static String DEFLATE = "deflate"; - public final static String ETAG = "o.e.j.s.Gzip.ETag"; public final static int DEFAULT_MIN_GZIP_SIZE=16; private int _minGzipSize=DEFAULT_MIN_GZIP_SIZE; private int _compressionLevel=Deflater.DEFAULT_COMPRESSION; @@ -415,11 +416,15 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory } // Special handling for etags - String etag = request.getHeader("If-None-Match"); + String etag = baseRequest.getHttpFields().get(HttpHeader.IF_NONE_MATCH); if (etag!=null) { - if (etag.contains(GzipHttpContent.ETAG_GZIP)) - request.setAttribute(ETAG,etag.replace(GzipHttpContent.ETAG_GZIP,"")); + int i=etag.indexOf(ETAG_GZIP_QUOTE); + while (i>=0) + { + baseRequest.getHttpFields().put(new HttpField(HttpHeader.ETAG,etag.substring(0,i)+etag.substring(i+GzipHttpContent.ETAG_GZIP.length()))); + i=etag.indexOf(ETAG_GZIP_QUOTE,i); + } } // install interceptor and handle |