django1/django
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
..
apps Refs #28909 -- Simplifed code using unpacking generalizations. 2018-09-28 09:57:12 -04:00
bin Reverted "Fixed #27878, refs #23919 -- Used python3 shebangs." 2017-03-07 10:10:32 -05:00
conf Fixed Italian's MONTH_DAY_FORMAT. 2018-10-20 05:09:41 -04:00
contrib Used method chaining in DateTimeShortcuts.js. 2018-11-09 19:56:46 -05:00
core Fixed keep-alive support in manage.py runserver. 2018-11-10 13:54:45 +01:00
db Fixed #29934 -- Added sqlparse as a require dependency. 2018-11-09 19:09:36 -05:00
dispatch Capitalized "Python" in docs and comments. 2018-10-09 09:26:07 -04:00
forms Refs #29689 -- Moved FilePathField choices sorting outside the loop. 2018-08-29 06:19:32 -04:00
http Normalized spelling of "lowercase" and "lowercased". 2018-09-25 10:30:18 -04:00
middleware Capitalized SecurityMiddleware headers for consistency with other headers. 2018-10-30 18:30:51 -04:00
template Refs #28909 -- Simplifed code using unpacking generalizations. 2018-09-28 09:57:12 -04:00
templatetags Replaced TOKEN_* constants by TokenType enums. 2018-05-10 17:51:51 +02:00
test Fixed #25251 -- Made data migrations available in TransactionTestCase when using --keepdb. 2018-11-06 16:57:50 -05:00
urls Fixed #29775 -- Fixed URL converters in a nested namespaced path. 2018-10-04 11:42:27 -04:00
utils Refs #29926 -- Removed usage of gettext.translation()'s deprecated codeset parameter. 2018-11-06 20:22:47 -05:00
views Fixed #29903 -- Added error message for invalid WeekArchiveView week_format. 2018-10-29 14:22:42 -04:00
__init__.py Bumped version; master is now 2.2 pre-alpha. 2018-05-17 09:37:06 -04:00
__main__.py Fixed #24857 -- Added "python -m django" entry point. 2015-09-07 19:54:32 -04:00
shortcuts.py Added missing word to render_to_response deprecation warning. 2018-05-16 10:06:36 +02:00