[Python-checkins] cpython (3.2): httplib test for early eof response. related to Issue13684

senthil.kumaran python-checkins at python.org
Sun Apr 29 04:21:49 CEST 2012


http://hg.python.org/cpython/rev/afabb0635b15
changeset:   76604:afabb0635b15
branch:      3.2
parent:      76601:f4b167309bee
user:        Senthil Kumaran <senthil at uthcode.com>
date:        Sun Apr 29 10:20:46 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
@@ -369,6 +369,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