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

Martin Panter report at bugs.python.org
Wed Feb 11 07:08:43 CET 2015


Martin Panter added the comment:

Thanks for helping with this Demian. The idea of raising the same exception in all cases is new to me. Initially I was opposed, but it is starting to make sense. Let me consider it some more. Here are some cases that could trigger this exception:

1. EOF before receiving any status line. This is the most common case. Currently triggers BadStatusLine.
2. EOF in the middle of the status line. Triggers BadStatusLine, or is treated as an empty set of header fields.
3. EOF in the middle of a header line, or before the terminating blank line. Ignored, possibly with HTTPMessage.defects set.
4. EOF after receiving 100 Continue response, but before the final response. Currently triggers the same BadStatusLine.
5. ConnectionReset anywhere before the blank line terminating the header section.

In all those cases it should be okay to automatically retry an idempotent request. With non-idempotent requests, retrying in these cases seems about equally dangerous.

For contrast, some related cases that can still be handled differently:

6. Connection reset or broken pipe in the request() method, since the server can still send a response
7. Unexpected EOF or connection reset when reading the response body. Perhaps this could also be handled with a similar ConnectionError exception. Currently IncompleteRead is raised for EOF, at least in most cases. IncompleteRead has also been suggested as an alternative to BadStatusLine in the past.

----------

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


More information about the Python-bugs-list mailing list