pub enum Component {
Method,
Authority,
Path,
Query,
RequestTarget,
Status,
Req(Box<Component>),
Header(String),
}Expand description
A covered component of an HTTP message signature.
This crate supports the derived components @method, @authority, @path,
@query, @request-target and @status, plus plain header fields and the
;req component parameter. @target-uri and the other parameters (for
example ;sf or ;key) are not modeled.
Variants§
Method
The request method (@method).
Authority
The request authority (@authority), lowercased.
Path
The absolute path (@path).
Query
The query string including the leading ? (@query).
RequestTarget
The request target (@request-target): the absolute path followed by
? and the query when one is present (RFC 9421 Section 2.2.5,
origin-form). The WIMSE profile requires this component to be signed.
Status
The response status code (@status), RFC 9421 Section 2.2.9. Only
meaningful on a response.
Req(Box<Component>)
A component taken from the request a response answers, written with
the ;req parameter (RFC 9421 Section 2.4) — for example
"@method";req. The WIMSE profile requires two of these on a signed
response, so that the response cannot be lifted onto a different
request.
Header(String)
A header field, identified by its lowercase name.
Implementations§
Source§impl Component
impl Component
Sourcepub fn quoted_id(&self) -> String
pub fn quoted_id(&self) -> String
The quoted component identifier as it appears in the signature base and
the inner list (for example "@method" or "content-type").
Sourcepub fn from_quoted_id(token: &str) -> Result<Self, HttpSigError>
pub fn from_quoted_id(token: &str) -> Result<Self, HttpSigError>
Parses a quoted component identifier back into a Component.
§Errors
Returns HttpSigError::UnsupportedComponent for an identifier this
crate does not model (including any carrying parameters), and
HttpSigError::Parse if the token is not a quoted string.