]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Added SVG to compressible mime types
authorJan van Hellemond <jan@frontlab.nl>
Sat, 6 Feb 2016 14:13:04 +0000 (15:13 +0100)
committerJan van Hellemond <jan@frontlab.nl>
Sat, 6 Feb 2016 14:13:04 +0000 (15:13 +0100)
This adds the mime type `image/svg+xml` to the whitelist of compressible mime types for the tornado.web.GZipContentEncoding class.

SVG images are served with the mime type `image/svg+xml`, but are not compressed by the GZipContentEncoding transform. My first thought was to add all mime types ending with `+xml`, but that might need a bit more research.

tornado/web.py

index c51d5f68a5cdddf09e9af0a2f449433b3bb8e840..fd971a8ca2caccf77f4cec9ef6f9b1590ea4ab1a 100644 (file)
@@ -2713,7 +2713,8 @@ class GZipContentEncoding(OutputTransform):
     # beginning with "text/").
     CONTENT_TYPES = set(["application/javascript", "application/x-javascript",
                          "application/xml", "application/atom+xml",
-                         "application/json", "application/xhtml+xml"])
+                         "application/json", "application/xhtml+xml",
+                         "image/svg+xml"])
     # Python's GzipFile defaults to level 9, while most other gzip
     # tools (including gzip itself) default to 6, which is probably a
     # better CPU/size tradeoff.