mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Fix two bugs in the new do_open() implementation for HTTPHandler.
Invoke the standard error handlers for non-200 responses. Always supply a "Connection: close" header to prevent the server from leaving the connection open. Downstream users of the socket may attempt recv()/read() with no arguments, which would block if the connection were kept open.
This commit is contained in:
parent
f0ae4272b4
commit
b3ee6f9921
2 changed files with 19 additions and 7 deletions
|
@ -461,7 +461,8 @@ class HandlerTests(unittest.TestCase):
|
|||
self.assertEqual(http.method, method)
|
||||
self.assertEqual(http.selector, "/")
|
||||
self.assertEqual(http.req_headers,
|
||||
[("Foo", "bar"), ("Spam", "eggs")])
|
||||
[("Connection", "close"),
|
||||
("Foo", "bar"), ("Spam", "eggs")])
|
||||
self.assertEqual(http.data, data)
|
||||
|
||||
# check socket.error converted to URLError
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue