Refs #30015 -- Added 2.1.5 release note and removed 'we' in comments.

This commit is contained in:
Carlton Gibson 2018-12-20 10:02:45 +01:00 committed by Tim Graham
parent 78dc7039bc
commit bbe28fa076
2 changed files with 13 additions and 10 deletions

View File

@ -83,11 +83,10 @@ class ServerHandler(simple_server.ServerHandler):
def __init__(self, stdin, stdout, stderr, environ, **kwargs):
"""
Setup a limited stream, so we can discard unread request data
at the end of the request. Django already uses `LimitedStream`
in `WSGIRequest` but it shouldn't discard the data since the
upstream servers usually do this. Hence we fix this only for
our testserver/runserver.
Use a LimitedStream so that unread request data will be ignored at
the end of the request. WSGIRequest uses a LimitedStream but it
shouldn't discard the data since the upstream servers usually do this.
This fix applies only for testserver/runserver.
"""
try:
content_length = int(environ.get('CONTENT_LENGTH'))
@ -97,13 +96,13 @@ class ServerHandler(simple_server.ServerHandler):
def cleanup_headers(self):
super().cleanup_headers()
# HTTP/1.1 requires us to support persistent connections, so
# explicitly send close if we do not know the content length to
# prevent clients from reusing the connection.
# HTTP/1.1 requires support for persistent connections. Send 'close' if
# the content length is unknown to prevent clients from reusing the
# connection.
if 'Content-Length' not in self.headers:
self.headers['Connection'] = 'close'
# Mark the connection for closing if we set it as such above or
# if the application sent the header.
# Mark the connection for closing if it's set as such above or if the
# application sent the header.
if self.headers.get('Connection') == 'close':
self.request_handler.close_connection = True

View File

@ -18,3 +18,7 @@ Bugfixes
* Prevented SQLite schema alterations while foreign key checks are enabled to
avoid the possibility of schema corruption (:ticket:`30023`).
* Fixed a regression in Django 2.1.4 (which enabled keep-alive connections)
where request body data isn't properly consumed for such connections
(:ticket:`30015`).