Opened 7 years ago

Last modified 5 years ago

#28440 closed Bug

Runserver does not correctly close connections once a response is sent — at Version 1

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 (last modified by Tom Forbes)

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 whilst the client is also reading from the socket.

Replacing the current handle function with handle_one_request fixes this problem, and still seems to use HTTP 1.1.

Change History (1)

comment:1 by Tom Forbes, 7 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top