diff options
author | groqez <groqez@yopmail.net> | 2014-03-05 00:35:36 +0100 |
---|---|---|
committer | groqez <groqez@yopmail.net> | 2014-03-18 19:47:02 +0100 |
commit | bffdadee57f4d412cb36db7e3f7303401d8c39d6 (patch) | |
tree | 6592e745c077305f24739368be6fd507b4736b8f /swiftclient/client.py | |
parent | d721dc7b61dabe49a603b781d44a05bfd9c9bed4 (diff) | |
download | python-swiftclient-bffdadee57f4d412cb36db7e3f7303401d8c39d6.tar.gz |
Decode HTTP responses, fixes bug #1282861
By default, the HTTPConnection class expose the raw.read urllib3
function which doesn't do any decoding on the http response.
We can fix this by passing decode_content=True to raw.read().
Change-Id: I7d42d31ae516705d1bde2769e642931308116c7a
Diffstat (limited to 'swiftclient/client.py')
-rw-r--r-- | swiftclient/client.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/swiftclient/client.py b/swiftclient/client.py index 72dac8d..ae16c17 100644 --- a/swiftclient/client.py +++ b/swiftclient/client.py @@ -22,6 +22,7 @@ import requests import sys import logging import warnings +import functools from distutils.version import StrictVersion from requests.exceptions import RequestException, SSLError @@ -210,7 +211,8 @@ class HTTPConnection: self.resp.getheaders = getheaders self.resp.getheader = getheader - self.resp.read = self.resp.raw.read + self.resp.read = functools.partial(self.resp.raw.read, + decode_content=True) return self.resp |