pub struct HeaderRules(/* private fields */);Expand description
The header predicates of one route-table rule (sozu-proxy/sozu#1253): a conjunction, empty for a rule without predicates.
It is part of the rule’s identity: Router’s add and remove paths
compare it alongside the path and method, so a canary rule that differs
from its base only by a predicate coexists with it, and removing one
leaves the other. The rules are kept in a canonical order, so two
spellings of one conjunction (other declaration order, other name case)
are one rule — the same canonicalisation the ConfigState key applies
(RequestHttpFrontend’s Display in command/src/request.rs).
Implementations§
Source§impl HeaderRules
impl HeaderRules
Sourcepub fn from_config(predicates: &[HeaderPredicate]) -> Result<Self, RouterError>
pub fn from_config(predicates: &[HeaderPredicate]) -> Result<Self, RouterError>
Compile a frontend’s predicates, held to
validate_header_predicate first. A regex value is compiled
anchored, refused when it does not compile exactly like a REGEX
path rule (the private anchored_regex helper compiles both).
pub fn is_empty(&self) -> bool
Sourcepub fn matches(&self, headers: &dyn RequestHeaders) -> bool
pub fn matches(&self, headers: &dyn RequestHeaders) -> bool
Whether every predicate holds for headers. True for an empty
conjunction, which never reads headers.