Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2014-08-19 21:56:32 -0400
committerGreg Wilkins2014-08-19 21:56:32 -0400
commit06cee4b08d5161c0f4406c3b5641773d28ac2559 (patch)
tree5a4518c32fe3f76d28ac2a00082d52b4669f5e4a /jetty-servlets
parentcaaa7c508c3e89645a449f8797a2aa5500ea3df8 (diff)
downloadorg.eclipse.jetty.project-06cee4b08d5161c0f4406c3b5641773d28ac2559.tar.gz
org.eclipse.jetty.project-06cee4b08d5161c0f4406c3b5641773d28ac2559.tar.xz
org.eclipse.jetty.project-06cee4b08d5161c0f4406c3b5641773d28ac2559.zip
441897 Fixed etag handling in gzipfilter
Diffstat (limited to 'jetty-servlets')
-rw-r--r--jetty-servlets/src/main/java/org/eclipse/jetty/servlets/AsyncGzipFilter.java6
-rw-r--r--jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/AbstractCompressedStream.java2
-rw-r--r--jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHttpOutput.java3
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);

Back to the top