1
0
mirror of https://github.com/django/django.git synced 2024-12-23 17:46:27 +00:00
Commit Graph

8 Commits

Author SHA1 Message Date
Jon Dufresne
c492fdfd24 Removed default empty content argument from HttpResponse calls. 2019-02-09 16:27:32 -05:00
Konstantin Alekseev
b514dc14f4 Fixed #30015 -- Ensured request body is properly consumed for keep-alive connections. 2018-12-19 11:27:08 +01:00
Florian Apolloner
934acf1126 Fixed keep-alive support in manage.py runserver.
Ticket #25619 changed the default protocol to HTTP/1.1 but did not
properly implement keep-alive. As a "fix" keep-alive was disabled in
ticket #28440 to prevent clients from hanging (they expect the server to
send more data if the connection is not closed and there is no content
length set).

The combination of those two fixes resulted in yet another problem:
HTTP/1.1 by default allows a client to assume that keep-alive is
supported unless the server disables it via 'Connection: close' -- see
RFC2616 8.1.2.1 for details on persistent connection negotiation. Now if
the client receives a response from Django without 'Connection: close'
and immediately sends a new request (on the same tcp connection) before
our server closes the tcp connection, it will error out at some point
because the connection does get closed a few milli seconds later.

This patch fixes the mentioned issues by always sending 'Connection:
close' if we cannot determine a content length. The code is inefficient
in the sense that it does not allow for persistent connections when
chunked responses are used, but that should not really cause any
problems (Django does not generate those) and it only affects the
development server anyways.

Refs #25619, #28440.
2018-11-10 13:54:45 +01:00
Jon Dufresne
a0f8c52ae2 Fixed ResourceWarnings in tests/servers/tests.py.
e.g. ResourceWarning: unclosed <socket.socket [closed] fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6>
2017-06-05 09:56:51 -04:00
Nadège Michel
bece837829 Fixed #20238 -- Added threading support to LiveServerTestCase. 2017-02-09 19:08:32 -05:00
Tim Graham
0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Simon Charette
11cd7388f7 Fixed #20989 -- Removed useless explicit list comprehensions. 2013-08-30 10:57:51 -04:00
Florian Apolloner
89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00