Kristján Valur Jónsson added the comment:

Ok, I'm adding a more comprehensive patch.  It adds support for
peek, readline, and read1 for both regular and chunked responses.
readline falls back to IOBase.readline for chunked, which again makes use of 
peek() for performance.
read1() is available for other kinds of client buffering, e.g. when reading the 
stream incrementally using other delimiters than newline.

The real work is done by the _read1_or_peek_chunked() method.  the code for 
both cases is almost identical so a dual purpose method is warranted.

Added test cases to test this.  The test cases don't attempt to test that we 
don't block on partial resopnses, though.  I'm not sure how I would write such 
a test.  I'd probably have to extend FakeSocket to work on some stream that can 
be appended to...

----------
Added file: http://bugs.python.org/file31804/httpresponse.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19009>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to