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 <rep...@bugs.python.org>
<http://bugs.python.org/issue26499>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to