Represents the state of a request/response cycle, tracking various metrics and properties
including connection details, caching information, and upstream server interactions.
An Inflight type tracks the frequency of actions that are actively occurring. When the value
is dropped from scope, the count will automatically decrease.
A Ctx value the access log can print. The {:name} in a log format
parses into one of these once, when the format is read, so writing a
log line dispatches on an enum instead of comparing the name against
every key on every request.
Compares two byte slices in constant time relative to their length, avoiding
the early exit of == that can leak (via timing) how many leading bytes
matched. Use it for verifying secrets, MACs and signatures. The slice
lengths are not treated as secret and are compared up front.
Generates a cache key from the request method, URI and state context.
The key includes an optional namespace and other key components if configured in the context.
Resolves a header value that cannot change for the life of the process -
$hostname and $<ENV_VAR> - so it can be stored as a plain value when
the configuration is loaded instead of being looked up on every request
(std::env::var takes a process-wide lock and allocates each time).
Values that depend on the request ($host, $http_*, :key, …) and
plain values come back unchanged, as does a $NAME whose variable is not
set, so the request path treats it exactly as before.