deflate seems to be problematic with different implementations (http://stackoverflow.com/questions/388595/why-use-deflate-instead-of-gzip-for-text-files-served-by-apache/388633#388633). Using gzip instead.
This commit is contained in:
parent
cb73a02bde
commit
383409213e
@ -333,9 +333,12 @@ class Application:
|
||||
encoding.strip() for encoding in
|
||||
environ.get("HTTP_ACCEPT_ENCODING", "").split(",")
|
||||
if encoding.strip()]
|
||||
if "deflate" in accept_encoding:
|
||||
answer = zlib.compress(answer)
|
||||
headers["Content-Encoding"] = "deflate"
|
||||
|
||||
if "gzip" in accept_encoding:
|
||||
zcomp = zlib.compressobj(wbits=16 + zlib.MAX_WBITS)
|
||||
answer = zcomp.compress(answer) + zcomp.flush()
|
||||
headers["Content-Encoding"] = "gzip"
|
||||
|
||||
headers["Content-Length"] = str(len(answer))
|
||||
|
||||
if self.configuration.has_section("headers"):
|
||||
|
Loading…
Reference in New Issue
Block a user