summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Burke <tim.burke@gmail.com>2015-05-20 16:07:04 -0700
committerTim Burke <tim.burke@gmail.com>2015-05-22 13:24:46 -0700
commit7d5c85ad1013185bd3aa7f0d384f2e0e68e3b484 (patch)
tree8d6cfedb220ce809908b4ebe03203a449b4b3ddd
parent52b849217f22b6185b7f6dc0b9ad6ab5a10ce132 (diff)
downloadpython-swiftclient-7d5c85ad1013185bd3aa7f0d384f2e0e68e3b484.tar.gz
Stop decoding object content
Previously, we had urllib3 (via requests) automatically decode all responses with a Content-Encoding of deflate or gzip. This included object downloads, which would in turn cause etag or content-length mismatch errors. (See bug 1338464) This was apparently added in response to a third-party proxy sitting between the client and server which, having observed that the client would accept gzip-encoded content while the server sent an unencoded response, would perform the compression. (See bug 1282861) Now, we'll no longer let requests send any default headers, nor do any decoding. Change-Id: I6cc30a5c12e37de06d7322533a3c36ad15397cc8 Closes-Bug: 1338464 Related-Bug: 1282861
-rw-r--r--swiftclient/client.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py
index 7f4c35b..082f476 100644
--- a/swiftclient/client.py
+++ b/swiftclient/client.py
@@ -170,6 +170,8 @@ class HTTPConnection(object):
self.port = self.parsed_url.port
self.requests_args = {}
self.request_session = requests.Session()
+ # Don't use requests's default headers
+ self.request_session.headers = None
if self.parsed_url.scheme not in ('http', 'https'):
raise ClientException('Unsupported scheme "%s" in url "%s"'
% (self.parsed_url.scheme, url))
@@ -238,7 +240,6 @@ class HTTPConnection(object):
return old_getheader(k.lower(), v)
def releasing_read(*args, **kwargs):
- kwargs['decode_content'] = True
chunk = self.resp.raw.read(*args, **kwargs)
if not chunk:
# NOTE(sigmavirus24): Release the connection back to the