summaryrefslogtreecommitdiff
path: root/django/middleware/gzip.py
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-20 03:45:48 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-10-20 03:45:48 +0000
commitc4cdb214a6a597bfd6fae6f855303b199b3d208d (patch)
treecf27cfb2ca5f91328efedbf5acbd99a426228b25 /django/middleware/gzip.py
parentb6ec8d3a9ef9315a947535bf99f5e92ae40ce99e (diff)
Fixed #5313 -- Only avoid compressing Javascript when the user agent says it's Internet Explorer. Thanks, mgiger@earthbrowser.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6538 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/middleware/gzip.py')
-rw-r--r--django/middleware/gzip.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/django/middleware/gzip.py b/django/middleware/gzip.py
index 7fd0d82419..aa2a8ea5a6 100644
--- a/django/middleware/gzip.py
+++ b/django/middleware/gzip.py
@@ -17,10 +17,11 @@ class GZipMiddleware(object):
return response
patch_vary_headers(response, ('Accept-Encoding',))
-
+
# Avoid gzipping if we've already got a content-encoding or if the
- # content-type is Javascript (silly IE...)
- is_js = "javascript" in response.get('Content-Type', '').lower()
+ # content-type is Javascript and the user's browser is IE.
+ is_js = ("msie" in request.META.get('HTTP_USER_AGENT', '').lower() and
+ "javascript" in response.get('Content-Type', '').lower())
if response.has_header('Content-Encoding') or is_js:
return response