Have upload auto-ungzip
If the server replies with gzip, automatically uncompress it. Change-Id: I3f0f5e9bdabf36b0fecd17b1ebd1a5b4d3734636
This commit is contained in:
@@ -258,7 +258,10 @@ class SecureHTTPConnection(httplib.HTTPConnection, object):
|
|||||||
if rsp.status != 200:
|
if rsp.status != 200:
|
||||||
raise Exception('Unexpected response in file upload: ' +
|
raise Exception('Unexpected response in file upload: ' +
|
||||||
rsp.read())
|
rsp.read())
|
||||||
return rsp.read()
|
body = rsp.read()
|
||||||
|
if rsp.getheader('Content-Encoding', None) == 'gzip':
|
||||||
|
body = gzip.GzipFile(fileobj=StringIO.StringIO(body)).read()
|
||||||
|
return body
|
||||||
|
|
||||||
def get_upload_progress(self):
|
def get_upload_progress(self):
|
||||||
return float(self._upbuffer.tell()) / float(self.ulsize)
|
return float(self._upbuffer.tell()) / float(self.ulsize)
|
||||||
|
|||||||
Reference in New Issue
Block a user