Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Bartel2015-02-06 00:23:05 +0000
committerJan Bartel2015-02-11 00:15:55 +0000
commitc7b8707849ada5b57fdaa78d2ee75e14b27df89b (patch)
treedb569601ce7b5792798a00f8aea0172bead38d04 /jetty-servlets
parenta187608013685f3d4ea3534f13ade097273e6b68 (diff)
downloadorg.eclipse.jetty.project-c7b8707849ada5b57fdaa78d2ee75e14b27df89b.tar.gz
org.eclipse.jetty.project-c7b8707849ada5b57fdaa78d2ee75e14b27df89b.tar.xz
org.eclipse.jetty.project-c7b8707849ada5b57fdaa78d2ee75e14b27df89b.zip
459125 GzipHandler default mimeType behavior incorrect
Diffstat (limited to 'jetty-servlets')
-rw-r--r--jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHandler.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHandler.java b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHandler.java
index a7d2d03097..c9976e4795 100644
--- a/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHandler.java
+++ b/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/gzip/GzipHandler.java
@@ -46,11 +46,11 @@ import org.eclipse.jetty.util.log.Logger;
/**
* GZIP Handler This handler will gzip the content of a response if:
* <ul>
- * <li>The filter is mapped to a matching path</li>
+ * <li>The handler is mapped to a matching path</li>
* <li>The response status code is >=200 and <300
* <li>The content length is unknown or more than the <code>minGzipSize</code> initParameter or the minGzipSize is 0(default)</li>
- * <li>The content-type is in the comma separated list of mimeTypes set in the <code>mimeTypes</code> initParameter or if no mimeTypes are defined the
- * content-type is not "application/gzip"</li>
+ * <li>The content-type matches one of the set of mimetypes to be compressed</li>
+ * <li>The content-type does NOT match one of the set of mimetypes AND setExcludeMimeTypes is <code>true</code></li>
* <li>No content-encoding is specified by the resource</li>
* </ul>
*
@@ -249,18 +249,21 @@ public class GzipHandler extends HandlerWrapper
@Override
protected void doStart() throws Exception
{
- if (_mimeTypes.size()==0)
+ if (_mimeTypes.size()==0 && _excludeMimeTypes)
{
+ _excludeMimeTypes = true;
for (String type:MimeTypes.getKnownMimeTypes())
{
+ if (type.equals("image/svg+xml")) //always compressable (unless .svgz file)
+ continue;
if (type.startsWith("image/")||
type.startsWith("audio/")||
type.startsWith("video/"))
_mimeTypes.add(type);
- _mimeTypes.add("application/compress");
- _mimeTypes.add("application/zip");
- _mimeTypes.add("application/gzip");
}
+ _mimeTypes.add("application/compress");
+ _mimeTypes.add("application/zip");
+ _mimeTypes.add("application/gzip");
}
super.doStart();
}

Back to the top