Soup.HSTSPolicy¶
Fields¶
None
Methods¶
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class Soup.HSTSPolicy¶
Soup.HSTSPolicy
implements HTTP policies, as described by RFC 6797.domain represents the host that this policy applies to. The domain must be IDNA-canonicalized. [ctor`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 isNone
, 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.- classmethod new(domain, max_age, include_subdomains)¶
- Parameters:
- Returns:
a new
Soup.HSTSPolicy
.- Return type:
Creates a new
Soup.HSTSPolicy
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.
- classmethod new_from_response(msg)¶
- Parameters:
msg (
Soup.Message
) – aSoup.Message
- Returns:
a new
Soup.HSTSPolicy
, orNone
if no valid “Strict-Transport-Security” response header was found.- Return type:
Parses msg's first “Strict-Transport-Security” response header and returns a
Soup.HSTSPolicy
.
- classmethod new_full(domain, max_age, expires, include_subdomains)¶
- Parameters:
- Returns:
a new
Soup.HSTSPolicy
.- Return type:
Full version of [ctor`HSTSPolicy`.new], to use with an existing expiration date.
See [ctor`HSTSPolicy`.new] for details.
- classmethod new_session_policy(domain, include_subdomains)¶
- Parameters:
- Returns:
a new
Soup.HSTSPolicy
.- Return type:
Creates a new session
Soup.HSTSPolicy
with the given attributes.A session policy is a policy that is valid during the lifetime of the [class`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.
- copy()¶
- Returns:
a copy of self
- Return type:
Copies self.
- equal(policy2)¶
- Parameters:
policy2 (
Soup.HSTSPolicy
) – aSoup.HSTSPolicy
- Returns:
whether the policies are equal.
- Return type:
Tests if self and policy2 are equal.
- free()¶
Frees self.
- get_expires()¶
- Returns:
A
GLib.DateTime
orNone
if unset- Return type:
Returns the expiration date for self.
- includes_subdomains()¶
-
Gets whether self include its subdomains.
- is_expired()¶
-
Gets whether self is expired.
Permanent policies never expire.