Opened 7 years ago
Last modified 6 years ago
#28440 closed Bug
Runserver does not correctly close connections once a response is sent — at Initial Version
Reported by: | Tom Forbes | Owned by: | nobody |
---|---|---|---|
Component: | HTTP handling | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Using MacOS Python 3.5, runserver does not terminate a connection once a HTTP response is sent. This seems to be caused by #25619 (but could be platform specific?).
This results in tools like curl
hanging forever, and browsers continually displaying the loading bar.
This code appears to be the culprit, it seems to be copied from the http.server
stdlib module. It handles a response and sends the contents correctly in the first iteration of the loop, but then self.close_connection
is still true, so it continues to try and read from the socket.
Removing the current handle
function with handle_one_request
fixes this problem, and still seems to use HTTP 1.1.