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.
|