MCPcopy
hub / github.com/django/django / _if_none_match_passes

Function _if_none_match_passes

django/utils/cache.py:244–260  ·  view source on GitHub ↗

Test the If-None-Match comparison as defined in RFC 9110 Section 13.1.2.

(target_etag, etags)

Source from the content-addressed store, hash-verified

242
243
244def _if_none_match_passes(target_etag, etags):
245 """
246 Test the If-None-Match comparison as defined in RFC 9110 Section 13.1.2.
247 """
248 if not target_etag:
249 # If there isn't an ETag, then there isn't a match.
250 return True
251 elif etags == ["*"]:
252 # The existence of an ETag means that there is "a current
253 # representation for the target resource", so there is a match to '*'.
254 return False
255 else:
256 # The comparison should be weak, so look for a match after stripping
257 # off any weak indicators.
258 target_etag = target_etag.strip("W/")
259 etags = (etag.strip("W/") for etag in etags)
260 return target_etag not in etags
261
262
263def _if_modified_since_passes(last_modified, if_modified_since):

Callers 1

get_conditional_responseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected