8000 Cleanup. · github3py/urllib3@08e86e5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 08e86e5

Browse files
committed
Cleanup.
1 parent 9b5729d commit 08e86e5

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ omit = urllib3/packages/*
55
exclude_lines =
66
.* # Platform-specific.*
77
except ImportError:
8-
try:.* # Python 3
8+
.*:.* # Python 3
99
pass
1010
.* # Abstract

urllib3/response.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,17 @@ def from_httplib(ResponseCls, r, **response_kw):
171171
with ``original_response=r``.
172172
"""
173173

174-
# comma-seperate header values with identical header names
174+
# Normalize headers between different versions of Python
175175
headers = {}
176176
for k, v in r.getheaders():
177-
# In Python 3, the header keys are returned capitalised
177+
# Python 3: Header keys are returned capitalised
178178
k = k.lower()
179-
if k in headers:
180-
headers[k] = headers[k] + ", " + v
181-
else:
182-
headers[k] = v
179+
180+
has_value = headers.get(k)
181+
if has_value: # Python 3: Repeating header keys are unmerged.
182+
v = ', '.join([has_value, v])
183+
184+
headers[k] = v
183185

184186
# HTTPResponse objects in Python 3 don't have a .strict attribute
185187
strict = getattr(r, 'strict', 0)

0 commit comments

Comments
 (0)
0