[issue26499] http.client.IncompleteRead from HTTPResponse read after part reading file

Martin Panter report at bugs.python.org
Wed Mar 9 04:21:58 EST 2016


Martin Panter added the comment:

Yes I agree it would be best to fix the bug(s) without major refactoring if practical.

To fix the other bug, I think the parameters in read1(n) and readline(limit) need to be capped at self.length.

The inherited BufferedIOBase.readlines() implementation should just call readline() multiple times. The point is that if you call readline() when self.length is reduced to zero, it should behave like EOF, rather than waiting for more data from the socket. To test this, you might be able to use the FakeSocket class. You might have to add a second HTTP response to the data, and test that readline() etc doesn’t read any of the second response.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26499>
_______________________________________


More information about the Python-bugs-list mailing list