Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 77f1b8a50d10ca9e393a7cb0d94c662be20e272a 1 parent 2e598fb
@jacobian jacobian authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 django/middleware/gzip.py
View
6 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', '')
Please sign in to comment.
Something went wrong with that request. Please try again.