This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients SilentGhost, kristjan.jonsson, martin.panter, maubp, serhiy.storchaka
Date 2016-03-09.07:29:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Thanks for the report and the patch. It looks okay as far as it goes, but I think there are other related bugs:

## read1() doesn’t update length either ##

>>> handle = urlopen("")
>>> len(handle.read1())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/proj/python/cpython/Lib/http/", line 462, in read
    s = self._safe_read(self.length)
  File "/home/proj/python/cpython/Lib/http/", line 614, in _safe_read
    raise IncompleteRead(b''.join(s), amt)
http.client.IncompleteRead: IncompleteRead(39583 bytes read, 7374 more expected)

## readline() and read1() blindly read beyond Content-Length ##

>>> conn = HTTPSConnection("")
>>> conn.request("GET", "/")
>>> resp = conn.getresponse()
>>> resp.readlines()  # Hangs until the connection is closed

I wonder if anyone has considered implementing HTTPResponse by wrapping or subclassing BufferedReader; that way you get well-tested readline() etc functionality for free. The HTTP protocol (Connection: close, Content-Length, chunked decoding) could be handled by an internal RawIOBase.readinto() method.
Date User Action Args
2016-03-09 07:29:47martin.pantersetrecipients: + martin.panter, kristjan.jonsson, SilentGhost, maubp, serhiy.storchaka
2016-03-09 07:29:47martin.pantersetmessageid: <>
2016-03-09 07:29:47martin.panterlinkissue26499 messages
2016-03-09 07:29:46martin.pantercreate