1
0
mirror of https://github.com/django/django.git synced 2025-07-18 16:49:13 +00:00

[1.0.X] Fixed #10630 -- Be even more conservative in GZipMiddleware for IE.

Patch from sebastien_noack.

Backport of r10541 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10542 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2009-04-12 04:15:45 +00:00
parent 6771f4e348
commit a83e4cb195

View File

@ -22,11 +22,10 @@ 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 pages containing either # MSIE have issues with gzipped respones of various content types.
# Javascript and PDF.
if "msie" in request.META.get('HTTP_USER_AGENT', '').lower(): if "msie" in request.META.get('HTTP_USER_AGENT', '').lower():
ctype = response.get('Content-Type', '').lower() ctype = response.get('Content-Type', '').lower()
if "javascript" in ctype or ctype == "application/pdf": if not ctype.startswith("text/") or "javascript" in ctype:
return response return response
ae = request.META.get('HTTP_ACCEPT_ENCODING', '') ae = request.META.get('HTTP_ACCEPT_ENCODING', '')