Django

Code

Changeset 6538

Show
Ignore:
Timestamp:
10/19/07 22:45:48 (1 year ago)
Author:
mtredinnick
Message:

Fixed #5313 -- Only avoid compressing Javascript when the user agent says it's Internet Explorer. Thanks, mgiger@earthbrowser.com.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/middleware/gzip.py

    r6235 r6538  
    1818 
    1919        patch_vary_headers(response, ('Accept-Encoding',)) 
    20          
     20 
    2121        # Avoid gzipping if we've already got a content-encoding or if the 
    22         # content-type is Javascript (silly IE...) 
    23         is_js = "javascript" in response.get('Content-Type', '').lower() 
     22        # content-type is Javascript and the user's browser is IE. 
     23        is_js = ("msie" in request.META.get('HTTP_USER_AGENT', '').lower() and 
     24                "javascript" in response.get('Content-Type', '').lower()) 
    2425        if response.has_header('Content-Encoding') or is_js: 
    2526            return response