pub enum CookieDomain {
HostOnly(String),
Suffix(String),
NotPresent,
Empty,
}Expand description
The domain of a Cookie
Variants§
HostOnly(String)
No Domain attribute in Set-Cookie header
Suffix(String)
Domain attribute from Set-Cookie header
NotPresent
Domain attribute was not present in the Set-Cookie header
Empty
Domain attribute-value was empty; technically undefined behavior, but suggested that this be treated as invalid
Implementations§
Source§impl CookieDomain
The concept of a domain match per IETF RFC6265 Section
5.1.3
impl CookieDomain
The concept of a domain match per IETF RFC6265 Section 5.1.3
Sourcepub fn host_only(request_url: &Url) -> Result<CookieDomain, CookieError>
pub fn host_only(request_url: &Url) -> Result<CookieDomain, CookieError>
Get the CookieDomain::HostOnly variant based on request_url. This is the effective behavior of
setting the domain-attribute to empty
Sourcepub fn matches(&self, request_url: &Url) -> bool
pub fn matches(&self, request_url: &Url) -> bool
Tests if the given url::Url meets the domain-match criteria
Sourcepub fn host_is_identical(&self, request_url: &Url) -> bool
pub fn host_is_identical(&self, request_url: &Url) -> bool
Tests if the given url::Url has a request-host identical to the domain attribute
Sourcepub fn is_public_suffix(&self, psl: &List) -> bool
pub fn is_public_suffix(&self, psl: &List) -> bool
Tests if the domain-attribute is a public suffix as indicated by the provided
publicsuffix::List.
Trait Implementations§
Source§impl Clone for CookieDomain
impl Clone for CookieDomain
Source§fn clone(&self) -> CookieDomain
fn clone(&self) -> CookieDomain
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CookieDomain
impl Debug for CookieDomain
Source§impl<'de> Deserialize<'de> for CookieDomain
impl<'de> Deserialize<'de> for CookieDomain
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<'a> From<&'a CookieDomain> for String
impl<'a> From<&'a CookieDomain> for String
Source§fn from(c: &'a CookieDomain) -> String
fn from(c: &'a CookieDomain) -> String
Source§impl Hash for CookieDomain
impl Hash for CookieDomain
Source§impl Ord for CookieDomain
impl Ord for CookieDomain
Source§fn cmp(&self, other: &CookieDomain) -> Ordering
fn cmp(&self, other: &CookieDomain) -> 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 CookieDomain
impl PartialEq for CookieDomain
Source§impl PartialOrd for CookieDomain
impl PartialOrd for CookieDomain
Source§impl Serialize for CookieDomain
impl Serialize for CookieDomain
Source§impl<'a, 'c> TryFrom<&'a Cookie<'c>> for CookieDomain
Construct a CookieDomain::Suffix from a cookie::Cookie, which handles stripping a leading
‘.’ for us. If the cookie.domain is None or an empty string, the CookieDomain::Empty variant
is returned.
NOTE: cookie::Cookie domain values already have the leading ‘.’ stripped. To avoid
performing this step twice, the From<&cookie::Cookie> impl should be used,
instead of passing cookie.domain to the From<&str> impl.
impl<'a, 'c> TryFrom<&'a Cookie<'c>> for CookieDomain
Construct a CookieDomain::Suffix from a cookie::Cookie, which handles stripping a leading
‘.’ for us. If the cookie.domain is None or an empty string, the CookieDomain::Empty variant
is returned.
NOTE: cookie::Cookie domain values already have the leading ‘.’ stripped. To avoid
performing this step twice, the From<&cookie::Cookie> impl should be used,
instead of passing cookie.domain to the From<&str> impl.
Source§impl<'a> TryFrom<&'a str> for CookieDomain
Construct a CookieDomain::Suffix from a string, stripping a single leading ‘.’ if present.
If the source string is empty, returns the CookieDomain::Empty variant.
impl<'a> TryFrom<&'a str> for CookieDomain
Construct a CookieDomain::Suffix from a string, stripping a single leading ‘.’ if present.
If the source string is empty, returns the CookieDomain::Empty variant.