mirror of
https://github.com/python/cpython.git
synced 2025-10-17 04:08:28 +00:00
fix handling of 100-continue status code (closes #18574)
This commit is contained in:
parent
4295353568
commit
044242360d
3 changed files with 8 additions and 3 deletions
|
@ -355,7 +355,7 @@ class BaseHTTPRequestHandler(socketserver.StreamRequestHandler):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.send_response_only(100)
|
self.send_response_only(100)
|
||||||
self.flush_headers()
|
self.end_headers()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def handle_one_request(self):
|
def handle_one_request(self):
|
||||||
|
|
|
@ -563,7 +563,8 @@ class BaseHTTPRequestHandlerTestCase(unittest.TestCase):
|
||||||
def test_with_continue_1_1(self):
|
def test_with_continue_1_1(self):
|
||||||
result = self.send_typical_request(b'GET / HTTP/1.1\r\nExpect: 100-continue\r\n\r\n')
|
result = self.send_typical_request(b'GET / HTTP/1.1\r\nExpect: 100-continue\r\n\r\n')
|
||||||
self.assertEqual(result[0], b'HTTP/1.1 100 Continue\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_expected_headers(result[2:-1])
|
||||||
self.verify_get_called()
|
self.verify_get_called()
|
||||||
self.assertEqual(result[-1], b'<html><body>Data</body></html>\r\n')
|
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'')
|
self.assertNotEqual(_readAndReseek(output), b'')
|
||||||
result = _readAndReseek(output).split(b'\r\n')
|
result = _readAndReseek(output).split(b'\r\n')
|
||||||
self.assertEqual(result[0], b'HTTP/1.1 100 Continue')
|
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):
|
def test_with_continue_rejected(self):
|
||||||
usual_handler = self.handler # Save to avoid breaking any subsequent tests.
|
usual_handler = self.handler # Save to avoid breaking any subsequent tests.
|
||||||
|
|
|
@ -43,6 +43,9 @@ Core and Builtins
|
||||||
Library
|
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 #20270: urllib.urlparse now supports empty ports.
|
||||||
|
|
||||||
- Issue #20243: TarFile no longer raise ReadError when opened in write mode.
|
- Issue #20243: TarFile no longer raise ReadError when opened in write mode.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue