Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
461c416d
Commit
461c416d
authored
Apr 03, 2019
by
Matt Houglum
Committed by
Serhiy Storchaka
Apr 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-36522: Print all values for headers with multiple values. (GH-12681)
parent
cb0748d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
Lib/http/client.py
Lib/http/client.py
+2
-2
Lib/test/test_httplib.py
Lib/test/test_httplib.py
+4
-2
Misc/NEWS.d/next/Library/2019-04-03-20-46-47.bpo-36522.g5x3By.rst
...S.d/next/Library/2019-04-03-20-46-47.bpo-36522.g5x3By.rst
+1
-0
No files found.
Lib/http/client.py
View file @
461c416d
...
...
@@ -320,8 +320,8 @@ class HTTPResponse(io.BufferedIOBase):
self
.
headers
=
self
.
msg
=
parse_headers
(
self
.
fp
)
if
self
.
debuglevel
>
0
:
for
hdr
in
self
.
headers
:
print
(
"header:"
,
hdr
+
":"
,
self
.
headers
.
get
(
hdr
)
)
for
hdr
,
val
in
self
.
headers
.
items
()
:
print
(
"header:"
,
hdr
+
":"
,
val
)
# are we using the chunked-style of transfer encoding?
tr_enc
=
self
.
headers
.
get
(
"transfer-encoding"
)
...
...
Lib/test/test_httplib.py
View file @
461c416d
...
...
@@ -348,7 +348,8 @@ class HeaderTests(TestCase):
body
=
(
b'HTTP/1.1 200 OK
\
r
\
n
'
b'First: val
\
r
\
n
'
b'Second: val
\
r
\
n
'
b'Second: val1
\
r
\
n
'
b'Second: val2
\
r
\
n
'
)
sock
=
FakeSocket
(
body
)
resp
=
client
.
HTTPResponse
(
sock
,
debuglevel
=
1
)
...
...
@@ -357,7 +358,8 @@ class HeaderTests(TestCase):
lines
=
output
.
getvalue
().
splitlines
()
self
.
assertEqual
(
lines
[
0
],
"reply: 'HTTP/1.1 200 OK
\
\
r
\
\
n'"
)
self
.
assertEqual
(
lines
[
1
],
"header: First: val"
)
self
.
assertEqual
(
lines
[
2
],
"header: Second: val"
)
self
.
assertEqual
(
lines
[
2
],
"header: Second: val1"
)
self
.
assertEqual
(
lines
[
3
],
"header: Second: val2"
)
class
TransferEncodingTest
(
TestCase
):
...
...
Misc/NEWS.d/next/Library/2019-04-03-20-46-47.bpo-36522.g5x3By.rst
0 → 100644
View file @
461c416d
If *debuglevel* is set to >0 in :mod:`http.client`, print all values for headers with multiple values for the same header name. Patch by Matt Houglum.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment