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
This commit is contained in:
parent
2e598fb571
commit
77f1b8a50d
|
@ -12,7 +12,11 @@ class GZipMiddleware(object):
|
||||||
"""
|
"""
|
||||||
def process_response(self, request, response):
|
def process_response(self, request, response):
|
||||||
patch_vary_headers(response, ('Accept-Encoding',))
|
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
|
return response
|
||||||
|
|
||||||
ae = request.META.get('HTTP_ACCEPT_ENCODING', '')
|
ae = request.META.get('HTTP_ACCEPT_ENCODING', '')
|
||||||
|
|
Loading…
Reference in New Issue