diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2006-07-31 21:31:35 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2006-07-31 21:31:35 +0000 |
| commit | 77f1b8a50d10ca9e393a7cb0d94c662be20e272a (patch) | |
| tree | be8620156d3a0ad24f304d53482e4449ccdedb55 /django/middleware/gzip.py | |
| parent | 2e598fb5718123a98d23638450496ec5a9e54205 (diff) | |
Fixed #2449 -- gzip middleware no longer gzips Javascript. Thanks for the prob, ubernostrum
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3503 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/middleware/gzip.py')
| -rw-r--r-- | django/middleware/gzip.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/django/middleware/gzip.py b/django/middleware/gzip.py index cc8a68406c..7d860abdb1 100644 --- a/django/middleware/gzip.py +++ b/django/middleware/gzip.py @@ -12,7 +12,11 @@ class GZipMiddleware(object): """ def process_response(self, request, response): patch_vary_headers(response, ('Accept-Encoding',)) - if response.has_header('Content-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.headers.get('Content-Type', '').lower() + if response.has_header('Content-Encoding') or is_js: return response ae = request.META.get('HTTP_ACCEPT_ENCODING', '') |
