]> granicus.if.org Git - python/commitdiff
httplib test for early eof response. related to Issue13684
authorSenthil Kumaran <senthil@uthcode.com>
Sun, 29 Apr 2012 02:15:31 +0000 (10:15 +0800)
committerSenthil Kumaran <senthil@uthcode.com>
Sun, 29 Apr 2012 02:15:31 +0000 (10:15 +0800)
Lib/test/test_httplib.py

index 38c0d2db0ede8d6f2b217ce9341f97115585b0db..05df87513a2ef74bc19c17fccae9aae96861b72e 100644 (file)
@@ -349,6 +349,14 @@ class BasicTest(TestCase):
         resp.begin()
         self.assertRaises(httplib.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 = httplib.HTTPResponse(sock)
+        resp.begin()
+        self.assertEqual(resp.read(), '')
+        self.assertTrue(resp.isclosed())
 
 class OfflineTest(TestCase):
     def test_responses(self):