#28440: Runserver does not correctly close connections once a response is sent
-------------------------------+--------------------------------------
Reporter: Tom | Owner: nobody
Type: Bug | Status: new
Component: HTTP handling | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Description changed by Tom:
Old 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.
>
> [https://github.com/django/django/blob/master/django/core/servers/basehttp.py#L137-L142
> 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.
New 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.
[https://github.com/django/django/blob/master/django/core/servers/basehttp.py#L137-L142
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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/28440#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/061.939a08d85b69e637910755538952fd54%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.