diff options
Diffstat (limited to 'django/utils/cache.py')
| -rw-r--r-- | django/utils/cache.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/django/utils/cache.py b/django/utils/cache.py index ce7faaedbc..cb49806ee9 100644 --- a/django/utils/cache.py +++ b/django/utils/cache.py @@ -142,12 +142,10 @@ def get_conditional_response(request, etag=None, last_modified=None, response=No # Get HTTP request headers. if_match_etags = parse_etags(request.META.get('HTTP_IF_MATCH', '')) if_unmodified_since = request.META.get('HTTP_IF_UNMODIFIED_SINCE') - if if_unmodified_since: - if_unmodified_since = parse_http_date_safe(if_unmodified_since) + if_unmodified_since = if_unmodified_since and parse_http_date_safe(if_unmodified_since) if_none_match_etags = parse_etags(request.META.get('HTTP_IF_NONE_MATCH', '')) if_modified_since = request.META.get('HTTP_IF_MODIFIED_SINCE') - if if_modified_since: - if_modified_since = parse_http_date_safe(if_modified_since) + if_modified_since = if_modified_since and parse_http_date_safe(if_modified_since) # Step 1 of section 6 of RFC 7232: Test the If-Match precondition. if if_match_etags and not _if_match_passes(etag, if_match_etags): |
