ETags and conditional requests: the preconditions of RFC 9110, section 13, and the If header of RFC 4918, section 10.4.
An ETag is an entity tag as a header writes it, e.g. ""v1"" or W/"v1" for a weak one. A resource is a map with its :etag and :last-modified, or nil when nothing is there.
ETags and conditional requests: the preconditions of RFC 9110, section 13, and the If header of RFC 4918, section 10.4. An ETag is an entity tag as a header writes it, e.g. "\"v1\"" or W/"v1" for a weak one. A resource is a map with its :etag and :last-modified, or nil when nothing is there.
(etag x)The entity tag of x: x itself when it's one, or else x as text
between quotes, without the quotes, spaces and control characters that
an entity tag can't hold, e.g. "7" for 7. It's nil for nil.
The entity tag of `x`: `x` itself when it's one, or else `x` as text between quotes, without the quotes, spaces and control characters that an entity tag can't hold, e.g. "7" for 7. It's nil for nil.
(evaluate method headers resource)The status that the preconditions in the lower-case headers of a
request by method give for the resource, or nil when the request
can go ahead: 412 when one fails, or 304 for a GET or a HEAD whose
If-None-Match or If-Modified-Since fails.
The preconditions go in the order of RFC 9110, section 13.2.2: If-Match, If-Unmodified-Since, If-None-Match and If-Modified-Since. If-Match uses the strong comparison and If-None-Match the weak one.
The status that the preconditions in the lower-case `headers` of a request by `method` give for the `resource`, or nil when the request can go ahead: 412 when one fails, or 304 for a GET or a HEAD whose If-None-Match or If-Modified-Since fails. The preconditions go in the order of RFC 9110, section 13.2.2: If-Match, If-Unmodified-Since, If-None-Match and If-Modified-Since. If-Match uses the strong comparison and If-None-Match the weak one.
(if-header lists)The If header value of the lists, as parse-if returns them.
The If header value of the `lists`, as parse-if returns them.
(if-true? lists state-of)Whether the If header's lists hold, given state-of, a function of a
list's :href that returns the :etag and the lock :tokens of its
resource (empty for an unmapped URL). Each list holds when all its
conditions do, and the header holds when any list does.
ETags match by the weak comparison, which section 10.4.4 allows.
Whether the If header's `lists` hold, given `state-of`, a function of a list's :href that returns the :etag and the lock :tokens of its resource (empty for an unmapped URL). Each list holds when all its conditions do, and the header holds when any list does. ETags match by the weak comparison, which section 10.4.4 allows.
(parse-etags s)The entity tags of the If-Match or If-None-Match header value s, as a
vector, or :any for *. A value without an entity tag gives none.
The entity tags of the If-Match or If-None-Match header value `s`, as a vector, or :any for *. A value without an entity tag gives none.
(parse-if s)The lists of the If header value s, as a vector of maps of its :href
(nil for the Request-URI) and its :conditions. A condition is a map of
a :token or an :etag, and :not?. It's nil when s isn't an If header.
(parse-if "(<urn:uuid:a> [\"x\"]) (Not <DAV:no-lock>)")
;; => [{:href nil :conditions [{:token "urn:uuid:a" :not? false}
;; {:etag "\"x\"" :not? false}]}
;; {:href nil :conditions [{:token "DAV:no-lock" :not? true}]}]
The lists of the If header value `s`, as a vector of maps of its :href
(nil for the Request-URI) and its :conditions. A condition is a map of
a :token or an :etag, and :not?. It's nil when `s` isn't an If header.
(parse-if "(<urn:uuid:a> [\"x\"]) (Not <DAV:no-lock>)")
;; => [{:href nil :conditions [{:token "urn:uuid:a" :not? false}
;; {:etag "\"x\"" :not? false}]}
;; {:href nil :conditions [{:token "DAV:no-lock" :not? true}]}](strong-match? a b)Whether the entity tags a and b match by the strong comparison:
neither is weak and they're the same.
Whether the entity tags `a` and `b` match by the strong comparison: neither is weak and they're the same.
(weak-match? a b)Whether the entity tags a and b match by the weak comparison: the
same apart from W/.
Whether the entity tags `a` and `b` match by the weak comparison: the same apart from W/.
(weak? tag)Whether the entity tag tag is weak.
Whether the entity tag `tag` is weak.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |