summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_httplib.py
diff options
context:
space:
mode:
authorSenthil Kumaran <senthil@uthcode.com>2012-04-29 02:21:26 (GMT)
committerSenthil Kumaran <senthil@uthcode.com>2012-04-29 02:21:26 (GMT)
commit889ad16e5453ccb2ac4faef34adf24615646c149 (patch)
tree2d5790c46a222655bba36ca892eb4cc50b58b73a /Lib/test/test_httplib.py
parente240947cc08b9655fec0787231ef27b01a1742d1 (diff)
parent9c29f86a81d159eaa7be47f0de7c78f7a88d78fd (diff)
downloadcpython-889ad16e5453ccb2ac4faef34adf24615646c149.zip
cpython-889ad16e5453ccb2ac4faef34adf24615646c149.tar.gz
cpython-889ad16e5453ccb2ac4faef34adf24615646c149.tar.bz2
httplib test for early eof response. related to Issue13684
Diffstat (limited to 'Lib/test/test_httplib.py')
-rw-r--r--Lib/test/test_httplib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
index 2a0b3e3..cc6cd07 100644
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -489,6 +489,15 @@ class BasicTest(TestCase):
resp.begin()
self.assertRaises(client.LineTooLong, resp.read)
+ def test_early_eof(self):
+ # Test httpresponse with no \r\n termination,
+ body = "HTTP/1.1 200 Ok"
+ sock = FakeSocket(body)
+ resp = client.HTTPResponse(sock)
+ resp.begin()
+ self.assertEqual(resp.read(), b'')
+ self.assertTrue(resp.isclosed())
+
class OfflineTest(TestCase):
def test_responses(self):
self.assertEqual(client.responses[client.NOT_FOUND], "Not Found")