1. django
  2. django

Commits

mtre...@bcc190cf-cafb-0310-a4f2-bffc1f526a37  committed 03133e9

Fixed #4969 -- Changed content retrieval in HttpResponse to be more robust in
the presence of an existing content encoding. Fixes some sporadic failures with
the GzipMiddleware, for example. Thanks, Johann Queuniet.

  • Participants
  • Parent commits ceb25bf
  • Branches default

Comments (0)

Files changed (1)

File django/http/__init__.py

View file
  • Ignore whitespace
         self.cookies[key]['max-age'] = 0
 
     def _get_content(self):
-        content = smart_str(''.join(self._container), self._charset)
-        return content
+        if self.has_header('Content-Encoding'):
+            return ''.join(self._container)
+        return smart_str(''.join(self._container), self._charset)
 
     def _set_content(self, value):
         self._container = [value]