Struct soup::HSTSPolicy
source · pub struct HSTSPolicy { /* private fields */ }
Expand description
#SoupHSTSPolicy implements HTTP policies, as described by RFC 6797.
@domain represents the host that this policy applies to. The domain
must be IDNA-canonicalized. HSTSPolicy::new()
and related methods
will do this for you.
@max_age contains the ‘max-age’ value from the Strict Transport Security header and indicates the time to live of this policy, in seconds.
@expires will be non-None
if the policy has been set by the host and
hence has an expiry time. If @expires is None
, it indicates that the
policy is a permanent session policy set by the user agent.
If @include_subdomains is true
, the Strict Transport Security policy
must also be enforced on subdomains of @domain.
Implementations§
source§impl HSTSPolicy
impl HSTSPolicy
sourcepub fn as_ptr(&self) -> *mut SoupHSTSPolicy
pub fn as_ptr(&self) -> *mut SoupHSTSPolicy
Return the inner pointer to the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow<'a>(
ptr: *const *const SoupHSTSPolicy
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const SoupHSTSPolicy ) -> &'a Self
Borrows the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow_mut<'a>(
ptr: *mut *mut SoupHSTSPolicy
) -> &'a mut Self
pub unsafe fn from_glib_ptr_borrow_mut<'a>( ptr: *mut *mut SoupHSTSPolicy ) -> &'a mut Self
Borrows the underlying C value mutably.
source§impl HSTSPolicy
impl HSTSPolicy
sourcepub fn new(
domain: &str,
max_age: c_ulong,
include_subdomains: bool
) -> HSTSPolicy
pub fn new( domain: &str, max_age: c_ulong, include_subdomains: bool ) -> HSTSPolicy
Creates a new #SoupHSTSPolicy with the given attributes.
@domain is a domain on which the strict transport security policy represented by this object must be enforced.
@max_age is used to set the “expires” attribute on the policy; pass
SOUP_HSTS_POLICY_MAX_AGE_PAST
for an already-expired policy, or a
lifetime in seconds.
If @include_subdomains is true
, the strict transport security policy
must also be enforced on all subdomains of @domain.
§domain
policy domain or hostname
§max_age
max age of the policy
§include_subdomains
true
if the policy applies on subdomains
§Returns
a new #SoupHSTSPolicy.
sourcepub fn from_response(msg: &Message) -> Option<HSTSPolicy>
pub fn from_response(msg: &Message) -> Option<HSTSPolicy>
sourcepub fn new_full(
domain: &str,
max_age: c_ulong,
expires: &DateTime,
include_subdomains: bool
) -> HSTSPolicy
pub fn new_full( domain: &str, max_age: c_ulong, expires: &DateTime, include_subdomains: bool ) -> HSTSPolicy
Full version of HSTSPolicy::new()
, to use with an existing
expiration date.
See HSTSPolicy::new()
for details.
§domain
policy domain or hostname
§max_age
max age of the policy
§expires
the date of expiration of the policy or None
for a permanent policy
§include_subdomains
true
if the policy applies on subdomains
§Returns
a new #SoupHSTSPolicy.
sourcepub fn new_session_policy(domain: &str, include_subdomains: bool) -> HSTSPolicy
pub fn new_session_policy(domain: &str, include_subdomains: bool) -> HSTSPolicy
Creates a new session #SoupHSTSPolicy with the given attributes.
A session policy is a policy that is valid during the lifetime of
the HSTSEnforcer
it is added to. Contrary to regular policies,
it has no expiration date and is not stored in persistent
enforcers. These policies are useful for user-agent to load their
own or user-defined rules.
@domain is a domain on which the strict transport security policy represented by this object must be enforced.
If @include_subdomains is true
, the strict transport security policy
must also be enforced on all subdomains of @domain.
§domain
policy domain or hostname
§include_subdomains
true
if the policy applies on sub domains
§Returns
a new #SoupHSTSPolicy.
sourcepub fn includes_subdomains(&mut self) -> bool
pub fn includes_subdomains(&mut self) -> bool
sourcepub fn is_expired(&mut self) -> bool
pub fn is_expired(&mut self) -> bool
Trait Implementations§
source§impl Clone for HSTSPolicy
impl Clone for HSTSPolicy
source§impl Debug for HSTSPolicy
impl Debug for HSTSPolicy
source§impl From<HSTSPolicy> for Value
impl From<HSTSPolicy> for Value
source§fn from(o: HSTSPolicy) -> Self
fn from(o: HSTSPolicy) -> Self
source§impl HasParamSpec for HSTSPolicy
impl HasParamSpec for HSTSPolicy
type ParamSpec = ParamSpecBoxed
§type SetValue = HSTSPolicy
type SetValue = HSTSPolicy
type BuilderFn = fn(_: &str) -> ParamSpecBoxedBuilder<'_, HSTSPolicy>
fn param_spec_builder() -> Self::BuilderFn
source§impl Hash for HSTSPolicy
impl Hash for HSTSPolicy
source§impl Ord for HSTSPolicy
impl Ord for HSTSPolicy
source§fn cmp(&self, other: &HSTSPolicy) -> Ordering
fn cmp(&self, other: &HSTSPolicy) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for HSTSPolicy
impl PartialEq for HSTSPolicy
source§fn eq(&self, other: &HSTSPolicy) -> bool
fn eq(&self, other: &HSTSPolicy) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for HSTSPolicy
impl PartialOrd for HSTSPolicy
source§fn partial_cmp(&self, other: &HSTSPolicy) -> Option<Ordering>
fn partial_cmp(&self, other: &HSTSPolicy) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for HSTSPolicy
impl StaticType for HSTSPolicy
source§fn static_type() -> Type
fn static_type() -> Type
Self
.