Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
HSTSPolicy
implements HTTP policies, as described by <ulink
url="http://tools.ietf.org/html/rfc6797">RFC 6797</ulink>.
To have a Session
handle HSTS policies for your appliction
automatically, use a HSTSEnforcer
.
Since: 2.68
Synopsis
- newtype HSTSPolicy = HSTSPolicy (ManagedPtr HSTSPolicy)
- newZeroHSTSPolicy :: MonadIO m => m HSTSPolicy
- hSTSPolicyCopy :: (HasCallStack, MonadIO m) => HSTSPolicy -> m HSTSPolicy
- hSTSPolicyEqual :: (HasCallStack, MonadIO m) => HSTSPolicy -> HSTSPolicy -> m Bool
- hSTSPolicyFree :: (HasCallStack, MonadIO m) => HSTSPolicy -> m ()
- hSTSPolicyGetDomain :: (HasCallStack, MonadIO m) => HSTSPolicy -> m Text
- hSTSPolicyIncludesSubdomains :: (HasCallStack, MonadIO m) => HSTSPolicy -> m Bool
- hSTSPolicyIsExpired :: (HasCallStack, MonadIO m) => HSTSPolicy -> m Bool
- hSTSPolicyIsSessionPolicy :: (HasCallStack, MonadIO m) => HSTSPolicy -> m Bool
- hSTSPolicyNew :: (HasCallStack, MonadIO m) => Text -> CULong -> Bool -> m HSTSPolicy
- hSTSPolicyNewFromResponse :: (HasCallStack, MonadIO m, IsMessage a) => a -> m (Maybe HSTSPolicy)
- hSTSPolicyNewFull :: (HasCallStack, MonadIO m) => Text -> CULong -> Date -> Bool -> m HSTSPolicy
- hSTSPolicyNewSessionPolicy :: (HasCallStack, MonadIO m) => Text -> Bool -> m HSTSPolicy
- clearHSTSPolicyDomain :: MonadIO m => HSTSPolicy -> m ()
- getHSTSPolicyDomain :: MonadIO m => HSTSPolicy -> m (Maybe Text)
- setHSTSPolicyDomain :: MonadIO m => HSTSPolicy -> CString -> m ()
- clearHSTSPolicyExpires :: MonadIO m => HSTSPolicy -> m ()
- getHSTSPolicyExpires :: MonadIO m => HSTSPolicy -> m (Maybe Date)
- setHSTSPolicyExpires :: MonadIO m => HSTSPolicy -> Ptr Date -> m ()
- getHSTSPolicyIncludeSubdomains :: MonadIO m => HSTSPolicy -> m Bool
- setHSTSPolicyIncludeSubdomains :: MonadIO m => HSTSPolicy -> Bool -> m ()
- getHSTSPolicyMaxAge :: MonadIO m => HSTSPolicy -> m CULong
- setHSTSPolicyMaxAge :: MonadIO m => HSTSPolicy -> CULong -> m ()
Exported types
newtype HSTSPolicy Source #
Memory-managed wrapper type.
HSTSPolicy (ManagedPtr HSTSPolicy) |
Instances
newZeroHSTSPolicy :: MonadIO m => m HSTSPolicy Source #
Construct a HSTSPolicy
struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
copy
:: (HasCallStack, MonadIO m) | |
=> HSTSPolicy |
|
-> m HSTSPolicy | Returns: a copy of |
Copies policy
.
Since: 2.68
equal
:: (HasCallStack, MonadIO m) | |
=> HSTSPolicy |
|
-> HSTSPolicy |
|
-> m Bool | Returns: whether the policies are equal. |
Tests if policy1
and policy2
are equal.
Since: 2.68
free
:: (HasCallStack, MonadIO m) | |
=> HSTSPolicy |
|
-> m () |
Frees policy
.
Since: 2.68
getDomain
:: (HasCallStack, MonadIO m) | |
=> HSTSPolicy |
|
-> m Text | Returns: |
Gets policy
's domain.
Since: 2.68
includesSubdomains
hSTSPolicyIncludesSubdomains Source #
:: (HasCallStack, MonadIO m) | |
=> HSTSPolicy |
|
-> m Bool | Returns: |
Gets whether policy
include its subdomains.
Since: 2.68
isExpired
:: (HasCallStack, MonadIO m) | |
=> HSTSPolicy |
|
-> m Bool |
Gets whether policy
is expired. Permanent policies never
expire.
Since: 2.68
isSessionPolicy
hSTSPolicyIsSessionPolicy Source #
:: (HasCallStack, MonadIO m) | |
=> HSTSPolicy |
|
-> m Bool |
Gets whether policy
is a non-permanent, non-expirable session policy.
see hSTSPolicyNewSessionPolicy
for details.
Since: 2.68
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> CULong |
|
-> Bool |
|
-> m HSTSPolicy | Returns: a new |
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.
maxAge
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 includeSubdomains
is True
, the strict transport security policy
must also be enforced on all subdomains of domain
.
Since: 2.68
newFromResponse
hSTSPolicyNewFromResponse Source #
:: (HasCallStack, MonadIO m, IsMessage a) | |
=> a |
|
-> m (Maybe HSTSPolicy) | Returns: a new |
Parses msg
's first "Strict-Transport-Security" response header and
returns a HSTSPolicy
.
Since: 2.68
newFull
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> CULong |
|
-> Date |
|
-> Bool |
|
-> m HSTSPolicy | Returns: a new |
Full version of soup_hsts_policy_new
(), to use with an existing
expiration date. See soup_hsts_policy_new
() for details.
Since: 2.68
newSessionPolicy
hSTSPolicyNewSessionPolicy Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Bool |
|
-> m HSTSPolicy | Returns: a new |
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 includeSubdomains
is True
, the strict transport security policy
must also be enforced on all subdomains of domain
.
Since: 2.68
Properties
domain
The domain or hostname that the policy applies to
clearHSTSPolicyDomain :: MonadIO m => HSTSPolicy -> m () Source #
Set the value of the “domain
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#domain
getHSTSPolicyDomain :: MonadIO m => HSTSPolicy -> m (Maybe Text) Source #
Get the value of the “domain
” field.
When overloading is enabled, this is equivalent to
get
hSTSPolicy #domain
setHSTSPolicyDomain :: MonadIO m => HSTSPolicy -> CString -> m () Source #
Set the value of the “domain
” field.
When overloading is enabled, this is equivalent to
set
hSTSPolicy [ #domain:=
value ]
expires
the policy expiration time, or Nothing
for a permanent session policy
clearHSTSPolicyExpires :: MonadIO m => HSTSPolicy -> m () Source #
Set the value of the “expires
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#expires
getHSTSPolicyExpires :: MonadIO m => HSTSPolicy -> m (Maybe Date) Source #
Get the value of the “expires
” field.
When overloading is enabled, this is equivalent to
get
hSTSPolicy #expires
setHSTSPolicyExpires :: MonadIO m => HSTSPolicy -> Ptr Date -> m () Source #
Set the value of the “expires
” field.
When overloading is enabled, this is equivalent to
set
hSTSPolicy [ #expires:=
value ]
includeSubdomains
True
if the policy applies on subdomains
getHSTSPolicyIncludeSubdomains :: MonadIO m => HSTSPolicy -> m Bool Source #
Get the value of the “include_subdomains
” field.
When overloading is enabled, this is equivalent to
get
hSTSPolicy #includeSubdomains
setHSTSPolicyIncludeSubdomains :: MonadIO m => HSTSPolicy -> Bool -> m () Source #
Set the value of the “include_subdomains
” field.
When overloading is enabled, this is equivalent to
set
hSTSPolicy [ #includeSubdomains:=
value ]
maxAge
The maximum age, in seconds, that the policy is valid
getHSTSPolicyMaxAge :: MonadIO m => HSTSPolicy -> m CULong Source #
Get the value of the “max_age
” field.
When overloading is enabled, this is equivalent to
get
hSTSPolicy #maxAge
setHSTSPolicyMaxAge :: MonadIO m => HSTSPolicy -> CULong -> m () Source #
Set the value of the “max_age
” field.
When overloading is enabled, this is equivalent to
set
hSTSPolicy [ #maxAge:=
value ]