summaryrefslogtreecommitdiff
path: root/django/utils/cache.py
diff options
context:
space:
mode:
authorViktor Lomakin <vl.dart.py@gmail.com>2019-10-09 12:20:17 +0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-10-10 09:51:05 +0200
commitee6b17187fbf19d498c16bd46ec6dd6aaf86f453 (patch)
treebc38aecdf701be369eecc22bd226357b82d1e390 /django/utils/cache.py
parent3cd3bebe8921e14b911b36b2a1cbceef8fb6294e (diff)
downloaddjango-ee6b17187fbf19d498c16bd46ec6dd6aaf86f453.tar.gz
Fixed #30812 -- Made ConditionalGetMiddleware set ETag only for responses with non-empty content.
Diffstat (limited to 'django/utils/cache.py')
-rw-r--r--django/utils/cache.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/utils/cache.py b/django/utils/cache.py
index 2b37acfd44..3ee01a1e94 100644
--- a/django/utils/cache.py
+++ b/django/utils/cache.py
@@ -98,7 +98,7 @@ def get_max_age(response):
def set_response_etag(response):
- if not response.streaming:
+ if not response.streaming and response.content:
response['ETag'] = quote_etag(hashlib.md5(response.content).hexdigest())
return response