aboutsummaryrefslogtreecommitdiff
path: root/urllib3/response.py
diff options
context:
space:
mode:
authorSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:31 -0700
committerSVN-Git Migration <python-modules-team@lists.alioth.debian.org>2015-10-08 13:19:31 -0700
commit77245469d4fbd400c6702cde35f9d9002540663e (patch)
tree5bbc97fd683f8f7354204d24be7974b268b19531 /urllib3/response.py
parent0c183b9d52b45bac22a2ff9db0e6348b655f4ab2 (diff)
downloadpython-urllib3-77245469d4fbd400c6702cde35f9d9002540663e.tar
python-urllib3-77245469d4fbd400c6702cde35f9d9002540663e.tar.gz
Imported Upstream version 1.3
Diffstat (limited to 'urllib3/response.py')
-rw-r--r--urllib3/response.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/urllib3/response.py b/urllib3/response.py
index 4dd431e..5fab824 100644
--- a/urllib3/response.py
+++ b/urllib3/response.py
@@ -171,11 +171,22 @@ class HTTPResponse(object):
with ``original_response=r``.
"""
+ # Normalize headers between different versions of Python
+ headers = {}
+ for k, v in r.getheaders():
+ # Python 3: Header keys are returned capitalised
+ k = k.lower()
+
+ has_value = headers.get(k)
+ if has_value: # Python 3: Repeating header keys are unmerged.
+ v = ', '.join([has_value, v])
+
+ headers[k] = v
+
# HTTPResponse objects in Python 3 don't have a .strict attribute
strict = getattr(r, 'strict', 0)
return ResponseCls(body=r,
- # In Python 3, the header keys are returned capitalised
- headers=dict((k.lower(), v) for k,v in r.getheaders()),
+ headers=headers,
status=r.status,
version=r.version,
reason=r.reason,