Author: jacob
Date: 2006-07-31 16:31:35 -0500 (Mon, 31 Jul 2006)
New Revision: 3503

Modified:
   django/trunk/django/middleware/gzip.py
Log:
Fixed #2449 -- gzip middleware no longer gzips Javascript.  Thanks for the 
prob, ubernostrum

Modified: django/trunk/django/middleware/gzip.py
===================================================================
--- django/trunk/django/middleware/gzip.py      2006-07-31 18:19:15 UTC (rev 
3502)
+++ django/trunk/django/middleware/gzip.py      2006-07-31 21:31:35 UTC (rev 
3503)
@@ -12,7 +12,11 @@
     """
     def process_response(self, request, response):
         patch_vary_headers(response, ('Accept-Encoding',))
-        if response.has_header('Content-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.headers.get('Content-Type', 
'').lower()
+        if response.has_header('Content-Encoding') or is_js:
             return response
 
         ae = request.META.get('HTTP_ACCEPT_ENCODING', '')


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to