AcceptEncoding
parses Accept-Encoding headers and performs server-side
content coding negotiation (RFC 9110 §12.5.3). Accept-Charset has no
counterpart here: RFC 9110 §12.5.2 deprecates it.
negotiate
(Fn [(Ref String a), (Ref (Array String) b)] (Maybe String))
(negotiate accept offers)
selects the best content coding to serve from offers given an
Accept-Encoding header value, per RFC 9110 §12.5.3, as (Maybe String). A
coding named by the field takes that entry's weight, one only * matches takes
the wildcard's, and any other coding is unacceptable — except identity, which
is acceptable at full weight unless the field rates it. A weight of 0 makes a
coding unacceptable rather than least preferred. The highest-weighted acceptable
offer wins, ties broken by the order of offers; matching is case-insensitive.
An empty Accept-Encoding accepts only identity; a request that sends no
Accept-Encoding at all accepts anything, which
Request.negotiate-encoding handles.
Nothing means nothing is acceptable.
parse
(Fn [(Ref String a)] (Array Weighted))
(parse s)
parses an Accept-Encoding header value into its weighted content
codings, in header order.