mirror of
https://opendev.org/x/pyghmi
synced 2025-01-15 04:07:48 +00:00
Have upload auto-ungzip
If the server replies with gzip, automatically uncompress it. Change-Id: I3f0f5e9bdabf36b0fecd17b1ebd1a5b4d3734636
This commit is contained in:
parent
24d424d89b
commit
963d8b40c1
@ -258,7 +258,10 @@ class SecureHTTPConnection(httplib.HTTPConnection, object):
|
||||
if rsp.status != 200:
|
||||
raise Exception('Unexpected response in file upload: ' +
|
||||
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):
|
||||
return float(self._upbuffer.tell()) / float(self.ulsize)
|
||||
|
Loading…
x
Reference in New Issue
Block a user