From: Senthil Kumaran Date: Sun, 29 Apr 2012 02:20:46 +0000 (+0800) Subject: httplib test for early eof response. related to Issue13684 X-Git-Tag: v3.3.0a3~49^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c29f86a81d159eaa7be47f0de7c78f7a88d78fd;p=thirdparty%2FPython%2Fcpython.git httplib test for early eof response. related to Issue13684 --- diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index ff033215b347..7c6c5bccf49f 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -369,6 +369,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")