[Python-checkins] cpython (3.3): fix handling of 100-continue status code (closes #18574)

benjamin.peterson python-checkins at python.org
Sun Jan 19 03:51:22 CET 2014


http://hg.python.org/cpython/rev/093ab6c02ff4
changeset: 88561:093ab6c02ff4
branch: 3.3
parent: 88557:706354c4d8f5
user: Benjamin Peterson <benjamin at python.org>
date: Sat Jan 18 21:50:18 2014 -0500
summary:
 fix handling of 100-continue status code (closes #18574)
files:
 Lib/http/server.py | 2 +-
 Lib/test/test_httpservers.py | 6 ++++--
 Misc/NEWS | 3 +++
 3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Lib/http/server.py b/Lib/http/server.py
--- a/Lib/http/server.py
+++ b/Lib/http/server.py
@@ -355,7 +355,7 @@
 
 """
 self.send_response_only(100)
- self.flush_headers()
+ self.end_headers()
 return True
 
 def handle_one_request(self):
diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py
--- a/Lib/test/test_httpservers.py
+++ b/Lib/test/test_httpservers.py
@@ -563,7 +563,8 @@
 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')
 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 @@
 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.
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -43,6 +43,9 @@
 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.
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /