Class

SoupHSTSEnforcer

Description [src]

class Soup.HSTSEnforcer : GObject.Object
  implements Soup.SessionFeature {
  /* No available fields */
}

Automatic HTTP Strict Transport Security enforcing for SoupSession.

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 the SoupMessage:uri property 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 SoupHSTSEnforcerDB for a persistent enforcer.

Hierarchy

hierarchy this SoupHSTSEnforcer implements_0 SoupSessionFeature this--implements_0 ancestor_0 GObject ancestor_0--this

Ancestors

Descendants

Implements

Constructors

soup_hsts_enforcer_new

Creates a new SoupHSTSEnforcer.

Instance methods

soup_hsts_enforcer_get_domains

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

soup_hsts_enforcer_get_policies

Gets a list with the policies in enforcer.

soup_hsts_enforcer_has_valid_policy

Gets whether hsts_enforcer has a currently valid policy for domain.

soup_hsts_enforcer_is_persistent

Gets whether hsts_enforcer stores policies persistenly.

soup_hsts_enforcer_set_policy

Sets policy to hsts_enforcer.

soup_hsts_enforcer_set_session_policy

Sets a session policy for domain.

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Signals

Soup.HSTSEnforcer::changed

Emitted when hsts_enforcer changes.

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct SoupHSTSEnforcerClass {
  GObjectClass parent_class;
  gboolean (* is_persistent) (
    SoupHSTSEnforcer* hsts_enforcer
  );
  gboolean (* has_valid_policy) (
    SoupHSTSEnforcer* hsts_enforcer,
    const char* domain
  );
  void (* changed) (
    SoupHSTSEnforcer* enforcer,
    SoupHSTSPolicy* old_policy,
    SoupHSTSPolicy* new_policy
  );
  
}

Class structure for SoupHSTSEnforcer.

Class members
parent_class: GObjectClass

The parent class.

is_persistent: gboolean (* is_persistent) ( SoupHSTSEnforcer* hsts_enforcer )

The is_persistent function advertises whether the enforcer is persistent or whether changes made to it will be lost when the underlying SoupSession is finished.

has_valid_policy: gboolean (* has_valid_policy) ( SoupHSTSEnforcer* hsts_enforcer, const char* domain )

The has_valid_policy function is called to check whether there is a valid policy for the given domain. This method should return TRUE for SoupHSTSEnforcer to change the scheme of the GUri in the SoupMessage to HTTPS. Implementations might want to chain up to the has_valid_policy in the parent class to check, for instance, for runtime policies.

changed: void (* changed) ( SoupHSTSEnforcer* enforcer, SoupHSTSPolicy* old_policy, SoupHSTSPolicy* new_policy )

The class closure for the SoupHSTSEnforcer::changed signal.

Virtual methods

Soup.HSTSEnforcerClass.changed

The class closure for the SoupHSTSEnforcer::changed signal.

Soup.HSTSEnforcerClass.has_valid_policy

Gets whether hsts_enforcer has a currently valid policy for domain.

Soup.HSTSEnforcerClass.is_persistent

Gets whether hsts_enforcer stores policies persistenly.