From 37809b891eae2e73c7e80fbf5d8b9a7e86e82b54 Mon Sep 17 00:00:00 2001 From: Adam Malinowski Date: Sat, 5 Nov 2016 12:39:46 +0100 Subject: Fixed #27346 -- Stopped setting the Content-Length header in ConditionalGetMiddleware. --- django/middleware/http.py | 5 ----- 1 file changed, 5 deletions(-) (limited to 'django') diff --git a/django/middleware/http.py b/django/middleware/http.py index 41389d930e..173bb49f89 100644 --- a/django/middleware/http.py +++ b/django/middleware/http.py @@ -11,13 +11,8 @@ class ConditionalGetMiddleware(MiddlewareMixin): Last-Modified header, and the request has If-None-Match or If-Modified-Since, the response is replaced by an HttpNotModified. An ETag header is added if needed. - - Also sets the Content-Length response-header. """ def process_response(self, request, response): - if not response.streaming and not response.has_header('Content-Length'): - response['Content-Length'] = str(len(response.content)) - # It's too late to prevent an unsafe request with a 412 response, and # for a HEAD request, the response body is always empty so computing # an accurate ETag isn't possible. -- cgit v1.3