Struct StrictTransportSecurity
pub struct StrictTransportSecurity { /* private fields */ }http only.Expand description
StrictTransportSecurity header, defined in RFC6797
This specification defines a mechanism enabling web sites to declare themselves accessible only via secure connections and/or for users to be able to direct their user agent(s) to interact with given sites only over secure connections. This overall policy is referred to as HTTP Strict Transport Security (HSTS). The policy is declared by web sites via the Strict-Transport-Security HTTP response header field and/or by other means, such as user agent configuration, for example.
§ABNF
[ directive ] *( ";" [ directive ] )
directive = directive-name [ "=" directive-value ]
directive-name = token
directive-value = token | quoted-string
§Example values
max-age=31536000max-age=15768000 ; includeSubdomains
§Example
use std::time::Duration;
use rama_http_headers::StrictTransportSecurity;
let sts = StrictTransportSecurity::including_subdomains_for_max_seconds(31_536_000);Implementations§
§impl StrictTransportSecurity
impl StrictTransportSecurity
pub fn including_subdomains_for_max_seconds(
max_age: u64,
) -> StrictTransportSecurity
pub fn including_subdomains_for_max_seconds( max_age: u64, ) -> StrictTransportSecurity
Create an STS header that includes subdomains
pub fn including_subdomains_for_max_duration_rounded(
dur: Duration,
) -> StrictTransportSecurity
pub fn including_subdomains_for_max_duration_rounded( dur: Duration, ) -> StrictTransportSecurity
Create an STS header that includes subdomains
The given Duration is rounded by ignoring any sub nano seconds.
Use Self::including_subdomains_for_max_duration in case you want to make
that a fallible case instead.
pub fn including_subdomains_for_max_duration(
dur: Duration,
) -> Option<StrictTransportSecurity>
pub fn including_subdomains_for_max_duration( dur: Duration, ) -> Option<StrictTransportSecurity>
Try to create a STS header that includes subdomains
§Error
Errors in case the given Duration contains sub nano seconds,
use Self::including_subdomains_for_max_seconds or
Self::including_subdomains_for_max_duration_rounded for a infallible constructor.
pub fn excluding_subdomains_for_max_seconds(
max_age: u64,
) -> StrictTransportSecurity
pub fn excluding_subdomains_for_max_seconds( max_age: u64, ) -> StrictTransportSecurity
Create an STS header that excludes subdomains
pub fn excluding_subdomains_for_max_duration_rounded(
dur: Duration,
) -> StrictTransportSecurity
pub fn excluding_subdomains_for_max_duration_rounded( dur: Duration, ) -> StrictTransportSecurity
Create an STS header that excludes subdomains
The given Duration is rounded by ignoring any sub nano seconds.
Use Self::excluding_subdomains_for_max_duration in case you want to make
that a fallible case instead.
pub fn excluding_subdomains_for_max_duration(
dur: Duration,
) -> Option<StrictTransportSecurity>
pub fn excluding_subdomains_for_max_duration( dur: Duration, ) -> Option<StrictTransportSecurity>
Try to create a STS header that excludes subdomains
§Error
Errors in case the given Duration contains sub nano seconds,
use Self::excluding_subdomains_for_max_seconds or
Self::excluding_subdomains_for_max_duration_rounded for a infallible constructor.
pub fn include_subdomains(&self) -> bool
pub fn include_subdomains(&self) -> bool
Get whether this should include subdomains.
Trait Implementations§
§impl Clone for StrictTransportSecurity
impl Clone for StrictTransportSecurity
§fn clone(&self) -> StrictTransportSecurity
fn clone(&self) -> StrictTransportSecurity
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for StrictTransportSecurity
impl Debug for StrictTransportSecurity
§impl HeaderDecode for StrictTransportSecurity
impl HeaderDecode for StrictTransportSecurity
§fn decode<'i, I>(values: &mut I) -> Result<StrictTransportSecurity, Error>where
I: Iterator<Item = &'i HeaderValue>,
fn decode<'i, I>(values: &mut I) -> Result<StrictTransportSecurity, Error>where
I: Iterator<Item = &'i HeaderValue>,
HeaderValues.§impl HeaderEncode for StrictTransportSecurity
impl HeaderEncode for StrictTransportSecurity
§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 more§impl PartialEq for StrictTransportSecurity
impl PartialEq for StrictTransportSecurity
§impl TypedHeader for StrictTransportSecurity
impl TypedHeader for StrictTransportSecurity
§fn name() -> &'static HeaderName
fn name() -> &'static HeaderName
impl StructuralPartialEq for StrictTransportSecurity
Auto Trait Implementations§
impl Freeze for StrictTransportSecurity
impl RefUnwindSafe for StrictTransportSecurity
impl Send for StrictTransportSecurity
impl Sync for StrictTransportSecurity
impl Unpin for StrictTransportSecurity
impl UnwindSafe for StrictTransportSecurity
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,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)§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> 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