Boost C++ Libraries

PrevUpHomeNext

Function accept_encoding_quality

boost::taar::accept_encoding_quality — The quality an Accept-Encoding field value gives coding (RFC 9110 12.5.3).

Synopsis

// In header: <boost/taar/core/accept_encoding.hpp>


std::optional< double > 
accept_encoding_quality(std::string_view field, std::string_view coding);

Description

Codings compare case-insensitively; x-gzip is an alias of gzip. An explicit entry for coding wins over *. Elements with a malformed q are skipped. The caller decides what an absent field means.

Parameters:

field

The Accept-Encoding field value, e.g. br;q=1.0, gzip;q=0.5, *;q=0.

coding

A content coding such as br, gzip or identity.

Returns:

The q-value in [0, 1] from the entry naming coding, else from *, else std::nullopt (not mentioned).


PrevUpHomeNext