Fixed #6480 -- Added application/pdf the list of content types we don't compress when sending to Internet Explorer. Thanks, Bastien Kleineidam.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@7080 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-02-04 01:40:53 +00:00
parent 0c4ea9b922
commit 5f477760ac
1 changed files with 6 additions and 6 deletions

View File

@ -22,11 +22,11 @@ class GZipMiddleware(object):
if response.has_header('Content-Encoding'): if response.has_header('Content-Encoding'):
return response return response
# Older versions of IE have issues with gzipped javascript. # Older versions of IE have issues with gzipped pages containing either
# See http://code.djangoproject.com/ticket/2449 # Javascript and PDF.
is_ie = "msie" in request.META.get('HTTP_USER_AGENT', '').lower() if "msie" in request.META.get('HTTP_USER_AGENT', '').lower():
is_js = "javascript" in response.get('Content-Type', '').lower() ctype = response.get('Content-Type', '').lower()
if is_ie and is_js: if "javascript" in ctype or ctype == "application/pdf":
return response return response
ae = request.META.get('HTTP_ACCEPT_ENCODING', '') ae = request.META.get('HTTP_ACCEPT_ENCODING', '')