This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author andymaier
Recipients andymaier
Date 2021-04-22.14:02:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1619100171.95.0.666024363299.issue43912@roundup.psfhosted.org>
In-reply-to
Content
Hello, we have a nasty occurrence of BadStatusLine that shows the status line of the request(!!) in one of our projects. That exception is raised when checking a response and should check the response, not the request. 

Further debugging revealed that not only the status line is from the request, but also the headers and the body of the response are from the request when this error happens.

Example exception when using http.client to send the requests:

    http.client.BadStatusLine: POST http://localhost:50000 HTTP/1.1

I have created a standalone script that can be used to reproduce the behavior. The script can use http.client or the requests package for sending the requests. The server is a threaded HTTP server.

The script needs to be run multiple times to reproduce the error. On my local system, the error showed up pretty reliably within the first 50 repetitions of the script.

The header comment of the script explains the details.

If http.client is chosen to be used, the script is purely based on standard Python library functions. The error shows up on all CPython versions I tried, up to 3.9.
History
Date User Action Args
2021-04-22 14:02:51andymaiersetrecipients: + andymaier
2021-04-22 14:02:51andymaiersetmessageid: <1619100171.95.0.666024363299.issue43912@roundup.psfhosted.org>
2021-04-22 14:02:51andymaierlinkissue43912 messages
2021-04-22 14:02:51andymaiercreate