1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #27345 -- Stopped setting the Date header in ConditionalGetMiddleware.

This commit is contained in:
Tim Graham
2016-10-14 08:02:19 -04:00
parent b679a3cdb1
commit 61f9243e51
4 changed files with 8 additions and 12 deletions

View File

@@ -2,7 +2,7 @@ from django.utils.cache import (
cc_delim_re, get_conditional_response, set_response_etag,
)
from django.utils.deprecation import MiddlewareMixin
from django.utils.http import http_date, parse_http_date_safe
from django.utils.http import parse_http_date_safe
class ConditionalGetMiddleware(MiddlewareMixin):
@@ -12,10 +12,9 @@ class ConditionalGetMiddleware(MiddlewareMixin):
If-Modified-Since, the response is replaced by an HttpNotModified. An ETag
header is added if needed.
Also sets the Date and Content-Length response-headers.
Also sets the Content-Length response-header.
"""
def process_response(self, request, response):
response['Date'] = http_date()
if not response.streaming and not response.has_header('Content-Length'):
response['Content-Length'] = str(len(response.content))