Ticket #2504: gzip.diff

File gzip.diff, 660 bytes (added by Fraser Nevett, 17 years ago)
  • django/middleware/gzip.py

     
    1111    on the Accept-Encoding header.
    1212    """
    1313    def process_response(self, request, response):
    14         if response.status_code != 200 or len(response.content) < 200:
     14        content_length = response.get_content_length()
     15        if response.status_code != 200 or (content_length and content_length < 200):
    1516            # Not worth compressing really short responses or 304 status
    1617            # responses, etc.
    1718            return response
Back to Top