summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_urllib2.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2004-02-24 19:40:35 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2004-02-24 19:40:35 (GMT)
commitb3ee6f9921a0979b77a64b83f2f3a267ae66916e (patch)
treeb13f188022498f176284594a12ea0d4e9cb2f34d /Lib/test/test_urllib2.py
parentf0ae4272b4b69576a51e5749820bf907799d1aca (diff)
downloadcpython-b3ee6f9921a0979b77a64b83f2f3a267ae66916e.zip
cpython-b3ee6f9921a0979b77a64b83f2f3a267ae66916e.tar.gz
cpython-b3ee6f9921a0979b77a64b83f2f3a267ae66916e.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_urllib2.py')
-rw-r--r--Lib/test/test_urllib2.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_urllib2.py b/Lib/test/test_urllib2.py
index 87de229..f38a4a3 100644
--- a/Lib/test/test_urllib2.py
+++ b/Lib/test/test_urllib2.py
@@ -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