diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-08-12 12:29:25 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2007-08-12 12:29:25 +0000 |
| commit | c050b6a25acff020fd60f2f528eb019615e00203 (patch) | |
| tree | dafca02b3036f4d66556953684de8b807444015c /django | |
| parent | 3757f30c99838783402b54d1cfd41958d1493aad (diff) | |
Fixed #4946 -- Added some small improvements to Gzip middleware. Thanks, colin@owlfish.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5875 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/middleware/gzip.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/django/middleware/gzip.py b/django/middleware/gzip.py index a7c74481d0..9b2a5f3d22 100644 --- a/django/middleware/gzip.py +++ b/django/middleware/gzip.py @@ -11,6 +11,11 @@ class GZipMiddleware(object): on the Accept-Encoding header. """ def process_response(self, request, response): + if response.status_code != 200 or len(response.content) < 200: + # Not worth compressing really short responses or 304 status + # responses, etc. + return response + patch_vary_headers(response, ('Accept-Encoding',)) # Avoid gzipping if we've already got a content-encoding or if the |
