[Python-checkins] cpython (merge 3.2 -> default): httplib test for early eof response. related to Issue13684
senthil.kumaran
python-checkins at python.org
Sun Apr 29 04:21:50 CEST 2012
http://hg.python.org/cpython/rev/cfff6a53f4a3
changeset: 76605:cfff6a53f4a3
parent: 76602:b1f29667a3c7
parent: 76604:afabb0635b15
user: Senthil Kumaran <senthil at uthcode.com>
date: Sun Apr 29 10:21:26 2012 +0800
summary:
httplib test for early eof response. related to Issue13684
files:
Lib/test/test_httplib.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py
--- a/Lib/test/test_httplib.py
+++ b/Lib/test/test_httplib.py
@@ -489,6 +489,15 @@
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")
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list