HSTSEnforcer

A #SoupHSTSEnforcer stores HSTS policies and enforces them when required. #SoupHSTSEnforcer implements #SoupSessionFeature, so you can add an HSTS enforcer to a session with soup_session_add_feature() or soup_session_add_feature_by_type().

#SoupHSTSEnforcer keeps track of all the HTTPS destinations that, when connected to, return the Strict-Transport-Security header with valid values. #SoupHSTSEnforcer will forget those destinations upon expiry or when the server requests it.

When the #SoupSession the #SoupHSTSEnforcer is attached to queues or restarts a message, the #SoupHSTSEnforcer will rewrite the URI to HTTPS if the destination is a known HSTS host and is contacted over an insecure transport protocol (HTTP). Users of #SoupHSTSEnforcer are advised to listen to changes in SoupMessage:uri in order to be aware of changes in the message URI.

Note that #SoupHSTSEnforcer does not support any form of long-term HSTS policy persistence. See #SoupHSTSDBEnforcer for a persistent enforcer.

Constructors

this
this(SoupHSTSEnforcer* soupHSTSEnforcer, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this()

Creates a new #SoupHSTSEnforcer. The base #SoupHSTSEnforcer class does not support persistent storage of HSTS policies, see #SoupHSTSEnforcerDB for that.

Members

Functions

addOnChanged
gulong addOnChanged(void delegate(HSTSPolicy, HSTSPolicy, HSTSEnforcer) dlg, ConnectFlags connectFlags)

Emitted when @hsts_enforcer changes. If a policy has been added, @new_policy will contain the newly-added policy and @old_policy will be %NULL. If a policy has been deleted, @old_policy will contain the to-be-deleted policy and @new_policy will be %NULL. If a policy has been changed, @old_policy will contain its old value, and @new_policy its new value.

addOnHstsEnforced
gulong addOnHstsEnforced(void delegate(Message, HSTSEnforcer) dlg, ConnectFlags connectFlags)

Emitted when @hsts_enforcer has upgraded the protocol for @message to HTTPS as a result of matching its domain with a HSTS policy.

getDomains
ListG getDomains(bool sessionPolicies)

Gets a list of domains for which there are policies in @enforcer.

getHSTSEnforcerStruct
SoupHSTSEnforcer* getHSTSEnforcerStruct(bool transferOwnership)

Get the main Gtk struct

getPolicies
ListG getPolicies(bool sessionPolicies)

Gets a list with the policies in @enforcer.

getStruct
void* getStruct()

the main Gtk struct as a void*

hasValidPolicy
bool hasValidPolicy(string domain)

Gets whether @hsts_enforcer has a currently valid policy for @domain.

isPersistent
bool isPersistent()

Gets whether @hsts_enforcer stores policies persistenly.

setPolicy
void setPolicy(HSTSPolicy policy)

Sets @policy to @hsts_enforcer. If @policy is expired, any existing HSTS policy for its host will be removed instead. If a policy existed for this host, it will be replaced. Otherwise, the new policy will be inserted. If the policy is a session policy, that is, one created with soup_hsts_policy_new_session_policy(), the policy will not expire and will be enforced during the lifetime of @hsts_enforcer's #SoupSession.

setSessionPolicy
void setSessionPolicy(string domain, bool includeSubdomains)

Sets a session policy for @domain. A session policy is a policy that is permanent to the lifetime of @hsts_enforcer's #SoupSession and doesn't expire.

Mixins

__anonymous
mixin SessionFeatureT!(SoupHSTSEnforcer)
Undocumented in source.

Static functions

getType
GType getType()

Variables

soupHSTSEnforcer
SoupHSTSEnforcer* soupHSTSEnforcer;

the main Gtk struct

Inherited Members

From SessionFeatureIF

getSessionFeatureStruct
SoupSessionFeature* getSessionFeatureStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
addFeature
bool addFeature(GType type)

Adds a "sub-feature" of type @type to the base feature @feature. This is used for features that can be extended with multiple different types. Eg, the authentication manager can be extended with subtypes of #SoupAuth.

attach
void attach(Session session)
detach
void detach(Session session)
hasFeature
bool hasFeature(GType type)

Tests if @feature has a "sub-feature" of type @type. See soup_session_feature_add_feature().

removeFeature
bool removeFeature(GType type)

Removes the "sub-feature" of type @type from the base feature @feature. See soup_session_feature_add_feature().

Meta