[issue19009] Enhance HTTPResponse.readline() performance

Serhiy Storchaka report at bugs.python.org
Fri Sep 20 20:39:02 CEST 2013


Serhiy Storchaka added the comment:

> A separate new function now takes care of the reading of chunk-header and tail.  This simplifies the other functions.

Good. It is even better than I expected.

> Do we gain anything by doing that, would it change the code? or would it merely be for the benefit of ABC?

Yes, it for the benefit of ABC. Some code tests isinstance(file, io.BufferedIOBase) and wraps stream in BufferedReader if it is false.

> Note that the chunk protocol was wrong and I fixed the unittests:  The final chunk is a _valid_ zero length chunk, i.e. 0\r\n\r\n.  It contains two eol tokens like other chunks, one at the end of the length, the other at the end of the(null) payload.

How new code processes invalid final chunk 0\r\n? We need test to check that there is no degradation.

Perhaps it relates to behavior change which I mention in the comment on Rietveld.

----------

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


More information about the Python-bugs-list mailing list