Http.Etag
Entity tags.
Support for conditional requests.
The type for etags.
val make : weak:bool -> string -> t
make ~weak tag
is the etag tag
. weak
indicates if the etag is weak.
Warning. The function does not check that the bytes of tag
are valid; each should be one of 0x21
, [0x23
;0x7E
] or [0x80
;0xFF
].
val is_weak : t -> bool
is_weak e
is true
iff e
is weak.
val tag : t -> string
tag e
is the entity tag of e
.
weak_match e0 e1
is true
iff e0
and e1
weakly match.
strong_match e0 e1
is true
iff e0
and e1
strongly match.
val encode : t -> string
encode etag
is etag
as an etag.
The type for etags conditions. This represents the value of Http.Headers.if_match
or Http.Headers.if_none_match
headers.
val decode_cond : string -> (cond, string) Stdlib.result
decode_cond s
parses an etag condition from s
.
val encode_cond : cond -> string
encode_cond c
serializes condition c
.
eval_if_match c t
evaluates the logic of an Http.Headers.if_match
header condition c
on an entity represented by t
(None
means the representation does not exist). This is:
true
if c
is None
(no condition).true
if t
is Some _
and c
is Some `Any
.true
if t
is Some etag
, c
is Some (`Etags etags)
and etag
strongly matches one of the etags
.false
otherwise.eval_if_none_match c t
evaluates the logic of an Http.Headers.if_none_match
header condition c
on an entity represented by t
(None
means the representation does not exist). This is:
true
if t
is None
and c
is Some `Any
.true
if t
is Some etag
, c
is Some (`Etags etags)
and etag
weakly matches none of the etags
false
otherwise.eval_if_range req t
evaluates the logic of an Http.Headers.if_range
header etag req
on an entity represented by t
(None
means the representation does not exist). This is:
true
if t
is Some etag
and etag
strongly matches req
false
otherwise.