finally:
resp.close()
+ def test_negative_content_length(self):
+ sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: -1\r\n\r\nHello\r\n')
+ resp = httplib.HTTPResponse(sock, method="GET")
+ resp.begin()
+ self.assertEquals(resp.read(), 'Hello\r\n')
+ resp.close()
+
class OfflineTest(TestCase):
def test_responses(self):
Library
-------
+- #1627: httplib now ignores negative Content-Length headers.
+
- #900744: If an invalid chunked-encoding header is sent by a server,
httplib will now raise IncompleteRead and close the connection instead
of raising ValueError.