mirror of
https://github.com/django/django.git
synced 2025-10-26 15:16:09 +00:00
Fixed #14103 -- Take USE_ETAGS setting into account when patching the response headers. Thanks, trbs and Eric Holscher.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14885 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -101,7 +101,7 @@ def patch_response_headers(response, cache_timeout=None):
|
||||
cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS
|
||||
if cache_timeout < 0:
|
||||
cache_timeout = 0 # Can't have max-age negative
|
||||
if not response.has_header('ETag'):
|
||||
if settings.USE_ETAGS and not response.has_header('ETag'):
|
||||
response['ETag'] = '"%s"' % md5_constructor(response.content).hexdigest()
|
||||
if not response.has_header('Last-Modified'):
|
||||
response['Last-Modified'] = http_date()
|
||||
|
||||
Reference in New Issue
Block a user