pub struct Message {
pub headers: HeaderMap,
pub trailers: HeaderMap,
/* private fields */
}integrity only.Expand description
Owned signature context, independent of HTTP versions and body types.
Servers must supply the effective external target URI. The HTTP/1.1 request target alone generally lacks scheme and authority. Only trusted routing/proxy configuration may provide missing context. HTTP/2 uses the same effective URI; pseudo-headers are represented by derived components.
Headers and trailers remain separate: "content-digest" and
"content-digest";tr are different covered components. Responses may retain
their originating request for ;req components. The snapshot must describe
the message actually transmitted, after content coding and header changes.
Fields§
§headers: HeaderMapThe message’s header section.
trailers: HeaderMapThe message’s trailer section, populated when it becomes available.
Implementations§
Source§impl Message
impl Message
Sourcepub fn request(
method: Method,
target: &str,
headers: HeaderMap,
) -> Result<Self, Error>
pub fn request( method: Method, target: &str, headers: HeaderMap, ) -> Result<Self, Error>
Creates request context from a method, absolute HTTP(S) URI, and headers. Userinfo and fragments are rejected because they are not HTTP targets.
Sourcepub fn from_request<B>(
request: &Request<B>,
effective_uri: &str,
) -> Result<Self, Error>
pub fn from_request<B>( request: &Request<B>, effective_uri: &str, ) -> Result<Self, Error>
Snapshots a request of any body type, including Axum’s non-Sync body.
effective_uri supplies the external URI; the original request-target
form is also retained for HTTP/1.x @request-target signatures.
Sourcepub fn response(
status: StatusCode,
headers: HeaderMap,
request: Option<Self>,
) -> Result<Self, Error>
pub fn response( status: StatusCode, headers: HeaderMap, request: Option<Self>, ) -> Result<Self, Error>
Creates response context. Supply a request snapshot to enable ;req.
Sourcepub fn with_structured_field(
self,
name: HeaderName,
kind: StructuredFieldType,
) -> Self
pub fn with_structured_field( self, name: HeaderName, kind: StructuredFieldType, ) -> Self
Registers a field’s actual Structured Fields type for ;sf processing.
Digest and signature dictionaries are already registered. Types are never
guessed by trying multiple parsers.
Sourcepub fn with_request_target(self, target: impl Into<String>) -> Self
pub fn with_request_target(self, target: impl Into<String>) -> Self
Supplies the actual protocol-specific request target for @request-target.
Prefer @target-uri when signatures must survive HTTP version changes.
Sourcepub fn fields(&self, section: FieldSection) -> &HeaderMap
pub fn fields(&self, section: FieldSection) -> &HeaderMap
Returns the chosen field section without merging headers and trailers.
Sourcepub fn fields_mut(&mut self, section: FieldSection) -> &mut HeaderMap
pub fn fields_mut(&mut self, section: FieldSection) -> &mut HeaderMap
Returns the chosen mutable field section.