From b2ac275cba8b9f46864ad07f50a1db485bcb6f43 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 13 Mar 2011 18:56:02 +0100 Subject: fixed gzip --- module/network/HTTPDownload.py | 2 +- module/web/middlewares.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'module') diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py index c43d714ef..ad6312508 100644 --- a/module/network/HTTPDownload.py +++ b/module/network/HTTPDownload.py @@ -102,7 +102,7 @@ class HTTPDownload(): fo.close() remove(init) self.info.remove() #there are probably invalid chunks - raise Exception("Downloaded content was smaller than expected") + raise Exception("Downloaded content was smaller than expected. Try to reduce download connections.") remove(fname) #remove chunk fo.close() diff --git a/module/web/middlewares.py b/module/web/middlewares.py index f8b2ed976..b71138e69 100644 --- a/module/web/middlewares.py +++ b/module/web/middlewares.py @@ -85,7 +85,11 @@ class GzipResponse(object): self.headers = headers ct = header_value(headers,'content-type') ce = header_value(headers,'content-encoding') - cl = int(header_value(headers, 'content-length')) + cl = header_value(headers, 'content-length') + if cl: + 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: -- cgit v1.2.3