Skip to content

Commit 9c29f86

Browse files
committed
httplib test for early eof response. related to Issue13684
1 parent 285e51b commit 9c29f86

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Lib/test/test_httplib.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,15 @@ def test_overflowing_chunked_line(self):
369369
resp.begin()
370370
self.assertRaises(client.LineTooLong, resp.read)
371371

372+
def test_early_eof(self):
373+
# Test httpresponse with no \r\n termination,
374+
body = "HTTP/1.1 200 Ok"
375+
sock = FakeSocket(body)
376+
resp = client.HTTPResponse(sock)
377+
resp.begin()
378+
self.assertEqual(resp.read(), b'')
379+
self.assertTrue(resp.isclosed())
380+
372381
class OfflineTest(TestCase):
373382
def test_responses(self):
374383
self.assertEqual(client.responses[client.NOT_FOUND], "Not Found")

0 commit comments

Comments
 (0)