[issue3566] httplib persistent connections violate MUST in RFC2616 sec 8.1.4.

Martin Panter report at bugs.python.org
Fri Feb 20 00:27:28 CET 2015


Martin Panter added the comment:

Posting RemoteDisconnected.v4.patch with these changes:

* Renamed ConnectionClosed → RemoteDisconnected. Hopefully avoids confusion with shutting down the local end of a connection, or closing a socket’s file descriptor.

* Dropped the HTTPConnection.closed attribute

* Dropped special distinction of ECONNRESET at start versus in middle of response. It certainly makes the code and tests simpler again, and I realize that distinction is not the most important problem to solve right now, if ever. Also avoids relying on the poorly defined BufferedReader.peek() method.

I would like to retain the backwards compatibility with BadStatusLine if that is okay though.

Requests and “urllib3”: I’m not overly familiar with the internals of these packages (Requests uses “urllib3”). I cannot find any reference to BadStatusLine handling in “urllib3”, and I suspect it might just rely on detecting a dropped connection before sending a request; see <https://github.com/shazow/urllib3/blob/c8e7ea5/urllib3/connectionpool.py#L236>. In my opinion this is a race condition, but it is helpful and works most of the time. So I suspect “urllib3” would not be affected by any changes made relating to BadStatusLine.

----------
Added file: http://bugs.python.org/file38178/RemoteDisconnected.v4.patch

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


More information about the Python-bugs-list mailing list