Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kirill Smelkov
cpython
Commits
04424236
Commit
04424236
authored
11 years ago
by
Benjamin Peterson
Browse files
Options
Download
Email Patches
Plain Diff
fix handling of 100-continue status code (closes #18574)
parent
42953535
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
Lib/http/server.py
Lib/http/server.py
+1
-1
Lib/test/test_httpservers.py
Lib/test/test_httpservers.py
+4
-2
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/http/server.py
View file @
04424236
...
...
@@ -355,7 +355,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
"""
self
.
send_response_only
(
100
)
self
.
flush
_headers
()
self
.
end
_headers
()
return
True
def
handle_one_request
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Lib/test/test_httpservers.py
View file @
04424236
...
...
@@ -563,7 +563,8 @@ class BaseHTTPRequestHandlerTestCase(unittest.TestCase):
def
test_with_continue_1_1
(
self
):
result
=
self
.
send_typical_request
(
b
'GET / HTTP/1.1
\r\n
Expect: 100-continue
\r\n\r\n
'
)
self
.
assertEqual
(
result
[
0
],
b
'HTTP/1.1 100 Continue
\r\n
'
)
self
.
assertEqual
(
result
[
1
],
b
'HTTP/1.1 200 OK
\r\n
'
)
self
.
assertEqual
(
result
[
1
],
b
'
\r\n
'
)
self
.
assertEqual
(
result
[
2
],
b
'HTTP/1.1 200 OK
\r\n
'
)
self
.
verify_expected_headers
(
result
[
2
:
-
1
])
self
.
verify_get_called
()
self
.
assertEqual
(
result
[
-
1
],
b
'<html><body>Data</body></html>
\r\n
'
)
...
...
@@ -631,7 +632,8 @@ class BaseHTTPRequestHandlerTestCase(unittest.TestCase):
self
.
assertNotEqual
(
_readAndReseek
(
output
),
b
''
)
result
=
_readAndReseek
(
output
).
split
(
b
'
\r\n
'
)
self
.
assertEqual
(
result
[
0
],
b
'HTTP/1.1 100 Continue'
)
self
.
assertEqual
(
result
[
1
],
b
'HTTP/1.1 200 OK'
)
self
.
assertEqual
(
result
[
1
],
b
''
)
self
.
assertEqual
(
result
[
2
],
b
'HTTP/1.1 200 OK'
)
def
test_with_continue_rejected
(
self
):
usual_handler
=
self
.
handler
# Save to avoid breaking any subsequent tests.
...
...
This diff is collapsed.
Click to expand it.
Misc/NEWS
View file @
04424236
...
...
@@ -43,6 +43,9 @@ Core and Builtins
Library
-------
- Issue #18574: Fixed handling of 100-continue reply from server in
http.client.HTTPConnection. Patch by Nikolaus Rath.
- Issue #20270: urllib.urlparse now supports empty ports.
- Issue #20243: TarFile no longer raise ReadError when opened in write mode.
...
...
This diff is collapsed.
Click to expand it.
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