From 5f477760ac02ad94a41f4a2373ed9ed9948a0ac3 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Mon, 4 Feb 2008 01:40:53 +0000 Subject: [PATCH] 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 --- django/middleware/gzip.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/django/middleware/gzip.py b/django/middleware/gzip.py index 62a2456b978..3b849801da4 100644 --- a/django/middleware/gzip.py +++ b/django/middleware/gzip.py @@ -22,12 +22,12 @@ class GZipMiddleware(object): if response.has_header('Content-Encoding'): return response - # Older versions of IE have issues with gzipped javascript. - # See http://code.djangoproject.com/ticket/2449 - is_ie = "msie" in request.META.get('HTTP_USER_AGENT', '').lower() - is_js = "javascript" in response.get('Content-Type', '').lower() - if is_ie and is_js: - return response + # Older versions of IE have issues with gzipped pages containing either + # Javascript and PDF. + if "msie" in request.META.get('HTTP_USER_AGENT', '').lower(): + ctype = response.get('Content-Type', '').lower() + if "javascript" in ctype or ctype == "application/pdf": + return response ae = request.META.get('HTTP_ACCEPT_ENCODING', '') if not re_accepts_gzip.search(ae):