Opened 14 years ago
Last modified 14 years ago
#15353 closed
problem with django.middleware.gzip.GZipMiddleware — at Initial Version
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | *.djangoproject.com | Version: | 1.2 |
Severity: | Keywords: | middleware gzip | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In django.middleware.gzip.GZipMiddleware have a bug:
def process_response(self, request, response):
# It's not worth compressing non-OK or really short responses.
if response.status_code != 200 or len(response.content) < 200:
return response
exist response without response.content!
when I use: (in url.py )
(r'media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}),
to binary files have a problem, do not exist response.content.
to solver the bug I add 'try' on code:
try:
if response.status_code != 200 or len(response.content) < 200:
return response
except:
return response
In my vision the middlewere gzip don't have compress binary, because the browser is incompatible