3.2 <SoupHSTSPolicy>

Structure: <SoupHSTSPolicy>

HSTSPolicy 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-#f if the policy has been set by the host and hence has an expiry time. If expires is #f, it indicates that the policy is a permanent session policy set by the user agent.

If include-subdomains is #t, the Strict Transport Security policy must also be enforced on subdomains of domain.

Procedures

Method: hstspolicy:copy self ⇒ %return
Method: copy self ⇒ %return

Copies self.

self

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

%return

Returned: a <SoupHSTSPolicy>.

a copy of self

Method: hstspolicy:equal? self policy2 ⇒ %return
Method: equal? self policy2 ⇒ %return

Tests if self and policy2 are equal.

self

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

policy2

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

%return

Returned: a boolean.

whether the policies are equal.

Method: hstspolicy:free self
Method: free self

Frees self.

self

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

Method: hstspolicy:get-domain self ⇒ %return
Method: get-domain self ⇒ %return

Gets self’s domain.

self

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

%return

Returned: a string.

self’s domain.

Method: hstspolicy:get-expires self ⇒ %return
Method: get-expires self ⇒ %return

Returns the expiration date for self.

self

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

%return

Returned: a <GDateTime>.

A <GDateTime> or #f if unset

Method: hstspolicy:get-max-age self ⇒ %return
Method: get-max-age self ⇒ %return

Returns the max age for self.

self

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

%return

Returned: an unsigned 64-bit integer.

Max age in seconds

Method: hstspolicy:includes-subdomains? self ⇒ %return
Method: includes-subdomains? self ⇒ %return

Gets whether self include its subdomains.

self

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

%return

Returned: a boolean.

#t if self includes subdomains, #f otherwise.

Method: hstspolicy:is-expired? self ⇒ %return
Method: is-expired? self ⇒ %return

Gets whether self is expired.

Permanent policies never expire.

self

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

%return

Returned: a boolean.

#t if self is expired, #f otherwise.

Method: hstspolicy:is-session-policy? self ⇒ %return
Method: is-session-policy? self ⇒ %return

Gets whether self is a non-permanent, non-expirable session policy.

See HSTSPolicy.new_session_policy for details.

self

Passed: a <SoupHSTSPolicy>.

a <SoupHSTSPolicy>

%return

Returned: a boolean.

#t if self is permanent, #f otherwise

Procedure: hstspolicy:new domain max-age include-subdomains ⇒ %return

Creates a new 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 #t, the strict transport security policy must also be enforced on all subdomains of domain.

domain

Passed: a string.

policy domain or hostname

max-age

Passed: an unsigned 64-bit integer.

max age of the policy

include-subdomains

Passed: a boolean.

#t if the policy applies on subdomains

%return

Returned: a <SoupHSTSPolicy>.

a new <SoupHSTSPolicy>.

Procedure: hstspolicy:new-from-response msg ⇒ %return

Parses msg’s first "Strict-Transport-Security" response header and returns a HSTSPolicy.

msg

Passed: a <SoupMessage>.

a <SoupMessage>

%return

Returned: a <SoupHSTSPolicy>, or #f.

a new <SoupHSTSPolicy>, or #f if no valid "Strict-Transport-Security" response header was found.

Procedure: hstspolicy:new-full domain max-age expires include-subdomains ⇒ %return

Full version of HSTSPolicy.new, to use with an existing expiration date.

See HSTSPolicy.new for details.

domain

Passed: a string.

policy domain or hostname

max-age

Passed: an unsigned 64-bit integer.

max age of the policy

expires

Passed: a <GDateTime>.

the date of expiration of the policy or #f for a permanent policy

include-subdomains

Passed: a boolean.

#t if the policy applies on subdomains

%return

Returned: a <SoupHSTSPolicy>.

a new <SoupHSTSPolicy>.

Procedure: hstspolicy:new-session-policy domain include-subdomains ⇒ %return

Creates a new session HSTSPolicy 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 #t, the strict transport security policy must also be enforced on all subdomains of domain.

domain

Passed: a string.

policy domain or hostname

include-subdomains

Passed: a boolean.

#t if the policy applies on sub domains

%return

Returned: a <SoupHSTSPolicy>.

a new <SoupHSTSPolicy>.