[snapshot/master] Do not send Content-Encoding when serving files
Previously we would set a Content-Encoding to whatever matches the
filename the user asked for. So if we were sending a .tar.gz file,
we would, in addition to setting Content-Type: application/x-tar
also set Content-Encoding: gzip.
Arguably that's wrong, since we have not, in fact, applied any
"additional content codings" to the entity-body, it already was a .gz
file.
At any rate, it breaks our setup with varnish, since varnish refuses to
send Content-Encoding: gzip responses to clients who have not advertised
they support it with an appropriate Accept-Encoding header. In such
cases varnish 3 would de-compress the file on the fly and send it on to
the client. Who ended up with a foo.tar, called foo.tar.gz,
considerably larger and, of course, with a different checksum too.
Thanks to Tollef for his help in diagnosing this issue.
---
web/app/snapshot/controllers/archive.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/web/app/snapshot/controllers/archive.py b/web/app/snapshot/controllers/archive.py
index e471a9c..2a4cc47 100644
--- a/web/app/snapshot/controllers/archive.py
+++ b/web/app/snapshot/controllers/archive.py
@@ -54,8 +54,8 @@ class SnapshotFileApp(FileApp):
(type, encoding) = mimetypes.guess_type(filename)
if not type is None:
h['Content-Type'] = type
- if not encoding is None:
- h['Content-Encoding'] = encoding
+ #if not encoding is None:
+ # h['Content-Encoding'] = encoding
expires = datetime.datetime.now() + datetime.timedelta(seconds = int(config['app_conf']['expires.archive.file']))
h['Expires'] = wsgiref.handlers.format_date_time( time.mktime( expires.timetuple() ))
h['Cache-Control'] = 'public, max-age=%d'%int(config['app_conf']['expires.archive.file'])
--
1.7.2.5
Reply to: