Enum AltSvc
pub enum AltSvc {
Clear,
Alternatives(NonEmptyVec<AlternativeService>),
}http and std only.Expand description
The Alt-Svc response header defined by RFC 7838 section 3.
Alternative services are ordered by server preference. Self::Clear
asks a client to invalidate every cached alternative for the origin.
Unknown parameters are ignored during decoding and are not re-encoded.
§Security
This header is an untrusted routing hint, not authorization. Consumers must
retain the origin URI authority and HTTP Host header; use the origin host
for SNI, certificate, and pin validation; reject weaker protocols; and
preserve proxy policy. See RFC 7838 sections 2.1 through 2.4 and 9.
§Example
use rama_http_headers::{AltSvc, AlternativeService, HeaderMapExt};
use rama_http_types::HeaderMap;
use rama_net::tls::ApplicationProtocol;
let service = AlternativeService::new(ApplicationProtocol::HTTP_3, 443)
.unwrap()
.with_max_age_seconds(3_600)
.with_persist(true);
let mut headers = HeaderMap::new();
headers.typed_insert(AltSvc::new(service));
assert_eq!(
headers["alt-svc"],
r#"h3=":443"; ma=3600; persist=1"#,
);Variants§
Clear
Invalidate every cached alternative service for the origin.
Alternatives(NonEmptyVec<AlternativeService>)
Ordered alternative services, most preferred first.
Implementations§
§impl AltSvc
impl AltSvc
pub fn new(service: AlternativeService) -> AltSvc
pub fn new(service: AlternativeService) -> AltSvc
Create a header advertising one alternative service.
pub fn alternatives(&self) -> Option<impl ExactSizeIterator>
pub fn alternatives(&self) -> Option<impl ExactSizeIterator>
Return the advertised services, or None for Self::Clear.
Trait Implementations§
impl Eq for AltSvc
§impl From<AlternativeService> for AltSvc
impl From<AlternativeService> for AltSvc
§fn from(service: AlternativeService) -> AltSvc
fn from(service: AlternativeService) -> AltSvc
§impl HeaderDecode for AltSvc
impl HeaderDecode for AltSvc
§fn decode<'i, I>(values: &mut I) -> Result<AltSvc, Error>where
I: Iterator<Item = &'i HeaderValue>,
fn decode<'i, I>(values: &mut I) -> Result<AltSvc, Error>where
I: Iterator<Item = &'i HeaderValue>,
HeaderValues.§impl HeaderEncode for AltSvc
impl HeaderEncode for AltSvc
§fn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
fn encode<E>(&self, values: &mut E)where
E: Extend<HeaderValue>,
HeaderValue, and add it to a container
which has HeaderValue type as each element. Read more§fn encode_to_value(&self) -> Option<HeaderValue>
fn encode_to_value(&self) -> Option<HeaderValue>
HeaderValue. Read moreimpl StructuralPartialEq for AltSvc
§impl TypedHeader for AltSvc
impl TypedHeader for AltSvc
§fn name() -> &'static HeaderName
fn name() -> &'static HeaderName
Auto Trait Implementations§
impl !Freeze for AltSvc
impl RefUnwindSafe for AltSvc
impl Send for AltSvc
impl Sync for AltSvc
impl Unpin for AltSvc
impl UnsafeUnpin for AltSvc
impl UnwindSafe for AltSvc
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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