summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httplib.py
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2003-05-05 16:13:58 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2003-05-05 16:13:58 (GMT)
commitc1b2cb9d8f70ed3a1209f53eae38f69be8248fcb (patch)
tree4910fb718225472f96cf2a7a3b540fdd922dadd3 /Lib/test/test_httplib.py
parent581c36773a5915411611d7079b62dce9976adaf1 (diff)
downloadcpython-c1b2cb9d8f70ed3a1209f53eae38f69be8248fcb.zip
cpython-c1b2cb9d8f70ed3a1209f53eae38f69be8248fcb.tar.gz
cpython-c1b2cb9d8f70ed3a1209f53eae38f69be8248fcb.tar.bz2
SF bug 622042: Don't expect response body from HEAD request.
Bug fix candidate.
Diffstat (limited to 'Lib/test/test_httplib.py')
-rw-r--r--Lib/test/test_httplib.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index 8764455..29f4503 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -78,4 +78,17 @@ def _test():
if cookies != hdr:
raise AssertionError, "multiple headers not combined properly"
+ # test that the library doesn't attempt to read any data
+ # from a head request
+ conn = httplib.HTTPConnection("www.python.org")
+ conn.connect()
+ conn.request("HEAD", "/", headers={"Connection" : "keep-alive"})
+ resp = conn.getresponse()
+ if resp.status != 200:
+ raise AssertionError, "Expected status 200, got %d" % resp.status
+ if resp.read() != "":
+ raise AssertionError, "Did not expect response from HEAD request"
+ resp.close()
+ conn.close()
+
test()