Check that we don't read past the end of the Content-Length stream
(self)
| 1417 | resp.close() |
| 1418 | |
| 1419 | def test_content_length_sync(self): |
| 1420 | """Check that we don't read past the end of the Content-Length stream""" |
| 1421 | extradata = b"extradata" |
| 1422 | expected = b"Hello123\r\n" |
| 1423 | sock = FakeSocket(b'HTTP/1.1 200 OK\r\nContent-Length: 10\r\n\r\n' + expected + extradata) |
| 1424 | resp = client.HTTPResponse(sock, method="GET") |
| 1425 | resp.begin() |
| 1426 | self.assertEqual(resp.read(), expected) |
| 1427 | # the file should now have our extradata ready to be read |
| 1428 | self.assertEqual(sock.file.read(), extradata) #we read to the end |
| 1429 | resp.close() |
| 1430 | |
| 1431 | def test_readlines_content_length(self): |
| 1432 | extradata = b"extradata" |
nothing calls this directly
no test coverage detected