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

View File

@ -18,3 +18,7 @@ Bugfixes
* Prevented SQLite schema alterations while foreign key checks are enabled to * Prevented SQLite schema alterations while foreign key checks are enabled to
avoid the possibility of schema corruption (:ticket:`30023`). 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`).