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
This commit is contained in:
Malcolm Tredinnick 2007-10-20 03:45:48 +00:00
parent b6ec8d3a9e
commit c4cdb214a6
1 changed files with 4 additions and 3 deletions

View File

@ -19,8 +19,9 @@ class GZipMiddleware(object):
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