diff options
-rw-r--r-- | module/web/middlewares.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/module/web/middlewares.py b/module/web/middlewares.py index e0e6c3102..57023dbdb 100644 --- a/module/web/middlewares.py +++ b/module/web/middlewares.py @@ -90,14 +90,14 @@ class GzipResponse(object): cl = int(cl) else: cl = 201 - self.compressible = False - if ct and (ct.startswith('text/') or ct.startswith('application/')) \ - and 'zip' not in ct and cl > 200: - self.compressible = True + if ce: self.compressible = False - if self.compressible: + elif ct and (ct.startswith('text/') or ct.startswith('application/')) \ + and 'zip' not in ct and 200 < cl < 1024*1024: + self.compressible = True headers.append(('content-encoding', 'gzip')) + remove_header(headers, 'content-length') self.headers = headers self.status = status |