summaryrefslogtreecommitdiff
path: root/django/middleware/gzip.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-04 01:40:53 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-02-04 01:40:53 +0000
commit5f477760ac02ad94a41f4a2373ed9ed9948a0ac3 (patch)
tree788b3cda81ba9eddd60ca86396fa773f8527a831 /django/middleware/gzip.py
parent0c4ea9b922206219c73a0de18620b79f2b24b5e1 (diff)
Fixed #6480 -- Added application/pdf the list of content types we don't compress when sending to Internet Explorer. Thanks, Bastien Kleineidam.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@7080 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/middleware/gzip.py')
-rw-r--r--django/middleware/gzip.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/django/middleware/gzip.py b/django/middleware/gzip.py
index 62a2456b97..3b849801da 100644
--- a/django/middleware/gzip.py
+++ b/django/middleware/gzip.py
@@ -22,12 +22,12 @@ class GZipMiddleware(object):
if response.has_header('Content-Encoding'):
return response
- # Older versions of IE have issues with gzipped javascript.
- # See http://code.djangoproject.com/ticket/2449
- is_ie = "msie" in request.META.get('HTTP_USER_AGENT', '').lower()
- is_js = "javascript" in response.get('Content-Type', '').lower()
- if is_ie and is_js:
- return response
+ # Older versions of IE have issues with gzipped pages containing either
+ # Javascript and PDF.
+ if "msie" in request.META.get('HTTP_USER_AGENT', '').lower():
+ ctype = response.get('Content-Type', '').lower()
+ if "javascript" in ctype or ctype == "application/pdf":
+ return response
ae = request.META.get('HTTP_ACCEPT_ENCODING', '')
if not re_accepts_gzip.search(ae):