summaryrefslogtreecommitdiff
path: root/django/middleware/gzip.py
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2012-02-09 18:57:13 +0000
committerJannis Leidel <jannis@leidel.info>2012-02-09 18:57:13 +0000
commitb926765a7c04e88a85f2360a238efde9ffe98244 (patch)
tree318fadbcfea3df03717481fdf0d0d4fa2dadba51 /django/middleware/gzip.py
parent4b71c9998e4983e193bb3b648a8a445edd54c52f (diff)
Fixed #16035 -- Appended the Etag response header if the GZipMiddleware is in use to follow RFC2616 better. Thanks, ext and dracos2.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17471 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/middleware/gzip.py')
-rw-r--r--django/middleware/gzip.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/django/middleware/gzip.py b/django/middleware/gzip.py
index 39ec624851..69f938cf0a 100644
--- a/django/middleware/gzip.py
+++ b/django/middleware/gzip.py
@@ -37,6 +37,9 @@ class GZipMiddleware(object):
if len(compressed_content) >= len(response.content):
return response
+ if response.has_header('ETag'):
+ response['ETag'] = re.sub('"$', ';gzip"', response['ETag'])
+
response.content = compressed_content
response['Content-Encoding'] = 'gzip'
response['Content-Length'] = str(len(response.content))