Author: mtredinnick
Date: 2007-10-19 22:45:48 -0500 (Fri, 19 Oct 2007)
New Revision: 6538

Modified:
   django/trunk/django/middleware/gzip.py
Log:
Fixed #5313 -- Only avoid compressing Javascript when the user agent says it's 
Internet Explorer. Thanks, [EMAIL PROTECTED]


Modified: django/trunk/django/middleware/gzip.py
===================================================================
--- django/trunk/django/middleware/gzip.py      2007-10-20 03:32:21 UTC (rev 
6537)
+++ django/trunk/django/middleware/gzip.py      2007-10-20 03:45:48 UTC (rev 
6538)
@@ -17,10 +17,11 @@
             return response
 
         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
 


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to