Struct HopByHopHeaderContext
pub struct HopByHopHeaderContext { /* private fields */ }http and std only.Expand description
Connection-specific metadata captured while sanitizing an HTTP message.
This type supports intermediaries that consume hop-by-hop fields and then
originate equivalent fields for the next hop. It deliberately retains only
valid HTTP/1.1 upgrade intent, TE: trailers capability, and non-nominated
trailer declarations.
Implementations§
§impl HopByHopHeaderContext
impl HopByHopHeaderContext
pub fn capture(headers: &HeaderMap, version: Version) -> HopByHopHeaderContext
pub fn capture(headers: &HeaderMap, version: Version) -> HopByHopHeaderContext
Capture connection-specific metadata without modifying the headers.
pub fn take(headers: &mut HeaderMap, version: Version) -> HopByHopHeaderContext
pub fn take(headers: &mut HeaderMap, version: Version) -> HopByHopHeaderContext
Capture connection-specific metadata and remove hop-by-hop fields.
Request-field exceptions remain in place. Use Self::take_response
when capturing a response so every nomination is removed.
pub fn take_response(
headers: &mut HeaderMap,
version: Version,
) -> HopByHopHeaderContext
pub fn take_response( headers: &mut HeaderMap, version: Version, ) -> HopByHopHeaderContext
Capture response metadata and remove all connection-specific fields.
Unlike Self::take, the message direction is known, so request-field
exceptions do not apply to Connection nominations.
pub fn nominated_headers(&self) -> &[HeaderName]
pub fn nominated_headers(&self) -> &[HeaderName]
Return the fields nominated by the original Connection header.
pub fn restore_trailer_headers(&self, headers: &mut HeaderMap, version: Version)
pub fn restore_trailer_headers(&self, headers: &mut HeaderMap, version: Version)
Restore captured Trailer fields for a target that supports trailers.
An existing target field takes precedence over the captured fields.
pub fn restore_response(
&self,
headers: &mut HeaderMap,
version: Version,
target_nominations: &[HeaderName],
)
pub fn restore_response( &self, headers: &mut HeaderMap, version: Version, target_nominations: &[HeaderName], )
Restore response metadata needed to originate the next hop.
This is intended for a transformation of the same response, such as
adaptation. It does not correlate a response with its request; relays
should use sanitize_hop_by_hop_response_headers for that validation.
The target headers are expected to have been sanitized first. Trailer
declarations remain removed when either the source or target nominated
Trailer as connection-specific.
pub fn restore_request(
&self,
headers: &mut HeaderMap,
version: Version,
target_nominations: &[HeaderName],
)
pub fn restore_request( &self, headers: &mut HeaderMap, version: Version, target_nominations: &[HeaderName], )
Restore metadata for an adapted or otherwise re-originated request.
In addition to common message metadata, this restores the normalized
TE: trailers capability required by the target HTTP version.
Trait Implementations§
§impl Clone for HopByHopHeaderContext
impl Clone for HopByHopHeaderContext
§fn clone(&self) -> HopByHopHeaderContext
fn clone(&self) -> HopByHopHeaderContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for HopByHopHeaderContext
impl Debug for HopByHopHeaderContext
§impl Default for HopByHopHeaderContext
impl Default for HopByHopHeaderContext
§fn default() -> HopByHopHeaderContext
fn default() -> HopByHopHeaderContext
Auto Trait Implementations§
impl Forget for HopByHopHeaderContext
impl Freeze for HopByHopHeaderContextwhere
*const [HeaderName] is !null: Freeze,
PhantomData<[HeaderName]>: Freeze,
*const [(HeaderName, HeaderValue)] is !null: Freeze,
PhantomData<[(HeaderName, HeaderValue)]>: Freeze,
*const Http1UpgradeIntent is !null: Freeze,
PhantomData<Http1UpgradeIntent>: Freeze,
impl Move for HopByHopHeaderContext
impl RefUnwindSafe for HopByHopHeaderContextwhere
Atomic<*mut ()>: RefUnwindSafe,
(HeaderName, HeaderValue): RefUnwindSafe,
UpgradeProtocol: RefUnwindSafe,
impl Send for HopByHopHeaderContextwhere
BoxRaw<[HeaderName]>: Send,
BoxRaw<[(HeaderName, HeaderValue)]>: Send,
BoxRaw<Http1UpgradeIntent>: Send,
impl Sync for HopByHopHeaderContextwhere
BoxRaw<[HeaderName]>: Sync,
BoxRaw<[(HeaderName, HeaderValue)]>: Sync,
BoxRaw<Http1UpgradeIntent>: Sync,
impl Unpin for HopByHopHeaderContextwhere
Box<[HeaderName]>: Unpin,
Box<[(HeaderName, HeaderValue)]>: Unpin,
Box<Http1UpgradeIntent>: Unpin,
impl UnsafeUnpin for HopByHopHeaderContextwhere
*const [HeaderName] is !null: UnsafeUnpin,
PhantomData<[HeaderName]>: UnsafeUnpin,
*const [(HeaderName, HeaderValue)] is !null: UnsafeUnpin,
PhantomData<[(HeaderName, HeaderValue)]>: UnsafeUnpin,
*const Http1UpgradeIntent is !null: UnsafeUnpin,
PhantomData<Http1UpgradeIntent>: UnsafeUnpin,
impl UnwindSafe for HopByHopHeaderContextwhere
BoxRaw<[HeaderName]>: UnwindSafe,
BoxRaw<[(HeaderName, HeaderValue)]>: UnwindSafe,
BoxRaw<Http1UpgradeIntent>: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more