New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
httplib: false BadStatusLine() raised #52697
Comments
Independent from HTTP strict, an invalid BadStatusLine() exception is raised when a keep-alive connection exceeds its timeout: client->server <request> which raises the exception. An easy workaround is to either poll information often enough for the server to not close the connection or close and reopen the connection. However, the exception is misleading. |
Hmm no code. |
Sorry the IncompleteRead reference was meant to be bpo-666219 |
This should likely be closed as a duplicate of bpo-3566, which has additional detail. |
bpo-3566 has added a new exception subclass, RemoteDisconnected, in 3.5. People are still complaining about the old BadStatusLine exception in Python 2 though. See bpo-23054. Python 2 could still get better documentation of the BadStatusLine exception. Currently it gives the impression that it only happens when the “strict” parameter is True, and a status line was received that was not understood. The exception message could also be improved. Due to bpo-7427, there is a special case to make the message literally two quote signs (''), representing an empty string. Perhaps messages like “End of stream signalled”, “No status line”, or “Empty status line” would be clearer. |
How about back-porting the v3.5 fix, and the new "RemoteDisconnected" exception? Is that reasonable? |
I don’t think so. It is best to avoid a new exception type (even a subclass) in a bug fix. That would break code which checks “type(exc) == BadStatusLine” or similar. Specific exception messages are supposed to be implementation details, and the current message is already quirky due to the change from bpo-7427 (released in 2.7a4). That is why I thought it might be reasonable to just change the exception message in a bug fix. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: