summaryrefslogtreecommitdiff
path: root/swiftclient/client.py
diff options
context:
space:
mode:
authorgroqez <groqez@yopmail.net>2014-03-05 00:35:36 +0100
committergroqez <groqez@yopmail.net>2014-03-18 19:47:02 +0100
commitbffdadee57f4d412cb36db7e3f7303401d8c39d6 (patch)
tree6592e745c077305f24739368be6fd507b4736b8f /swiftclient/client.py
parentd721dc7b61dabe49a603b781d44a05bfd9c9bed4 (diff)
downloadpython-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.py4
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