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 |
Synopsis
- newtype Cookie = Cookie (ManagedPtr Cookie)
- newZeroCookie :: MonadIO m => m Cookie
- cookieAppliesToUri :: (HasCallStack, MonadIO m) => Cookie -> URI -> m Bool
- cookieCopy :: (HasCallStack, MonadIO m) => Cookie -> m Cookie
- cookieDomainMatches :: (HasCallStack, MonadIO m) => Cookie -> Text -> m Bool
- cookieEqual :: (HasCallStack, MonadIO m) => Cookie -> Cookie -> m Bool
- cookieFree :: (HasCallStack, MonadIO m) => Cookie -> m ()
- cookieGetDomain :: (HasCallStack, MonadIO m) => Cookie -> m Text
- cookieGetExpires :: (HasCallStack, MonadIO m) => Cookie -> m (Maybe Date)
- cookieGetHttpOnly :: (HasCallStack, MonadIO m) => Cookie -> m Bool
- cookieGetName :: (HasCallStack, MonadIO m) => Cookie -> m Text
- cookieGetPath :: (HasCallStack, MonadIO m) => Cookie -> m Text
- cookieGetSameSitePolicy :: (HasCallStack, MonadIO m) => Cookie -> m SameSitePolicy
- cookieGetSecure :: (HasCallStack, MonadIO m) => Cookie -> m Bool
- cookieGetValue :: (HasCallStack, MonadIO m) => Cookie -> m Text
- cookieNew :: (HasCallStack, MonadIO m) => Text -> Text -> Text -> Text -> Int32 -> m Cookie
- cookieParse :: (HasCallStack, MonadIO m) => Text -> URI -> m (Maybe Cookie)
- cookieSetDomain :: (HasCallStack, MonadIO m) => Cookie -> Text -> m ()
- cookieSetExpires :: (HasCallStack, MonadIO m) => Cookie -> Date -> m ()
- cookieSetHttpOnly :: (HasCallStack, MonadIO m) => Cookie -> Bool -> m ()
- cookieSetMaxAge :: (HasCallStack, MonadIO m) => Cookie -> Int32 -> m ()
- cookieSetName :: (HasCallStack, MonadIO m) => Cookie -> Text -> m ()
- cookieSetPath :: (HasCallStack, MonadIO m) => Cookie -> Text -> m ()
- cookieSetSameSitePolicy :: (HasCallStack, MonadIO m) => Cookie -> SameSitePolicy -> m ()
- cookieSetSecure :: (HasCallStack, MonadIO m) => Cookie -> Bool -> m ()
- cookieSetValue :: (HasCallStack, MonadIO m) => Cookie -> Text -> m ()
- cookieToCookieHeader :: (HasCallStack, MonadIO m) => Cookie -> m Text
- cookieToSetCookieHeader :: (HasCallStack, MonadIO m) => Cookie -> m Text
- clearCookieDomain :: MonadIO m => Cookie -> m ()
- getCookieDomain :: MonadIO m => Cookie -> m (Maybe Text)
- setCookieDomain :: MonadIO m => Cookie -> CString -> m ()
- clearCookieExpires :: MonadIO m => Cookie -> m ()
- getCookieExpires :: MonadIO m => Cookie -> m (Maybe Date)
- setCookieExpires :: MonadIO m => Cookie -> Ptr Date -> m ()
- getCookieHttpOnly :: MonadIO m => Cookie -> m Bool
- setCookieHttpOnly :: MonadIO m => Cookie -> Bool -> m ()
- clearCookieName :: MonadIO m => Cookie -> m ()
- getCookieName :: MonadIO m => Cookie -> m (Maybe Text)
- setCookieName :: MonadIO m => Cookie -> CString -> m ()
- clearCookiePath :: MonadIO m => Cookie -> m ()
- getCookiePath :: MonadIO m => Cookie -> m (Maybe Text)
- setCookiePath :: MonadIO m => Cookie -> CString -> m ()
- getCookieSecure :: MonadIO m => Cookie -> m Bool
- setCookieSecure :: MonadIO m => Cookie -> Bool -> m ()
- clearCookieValue :: MonadIO m => Cookie -> m ()
- getCookieValue :: MonadIO m => Cookie -> m (Maybe Text)
- setCookieValue :: MonadIO m => Cookie -> CString -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Cookie Source # | |
GBoxed Cookie Source # | |
Defined in GI.Soup.Structs.Cookie | |
ManagedPtrNewtype Cookie Source # | |
Defined in GI.Soup.Structs.Cookie toManagedPtr :: Cookie -> ManagedPtr Cookie | |
TypedObject Cookie Source # | |
Defined in GI.Soup.Structs.Cookie | |
HasParentTypes Cookie Source # | |
Defined in GI.Soup.Structs.Cookie | |
tag ~ 'AttrSet => Constructible Cookie tag Source # | |
IsGValue (Maybe Cookie) Source # | Convert |
Defined in GI.Soup.Structs.Cookie gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Cookie -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Cookie) | |
type ParentTypes Cookie Source # | |
Defined in GI.Soup.Structs.Cookie |
Methods
Click to display all available methods, including inherited ones
Methods
appliesToUri, copy, domainMatches, equal, free, toCookieHeader, toSetCookieHeader.
Getters
getDomain, getExpires, getHttpOnly, getName, getPath, getSameSitePolicy, getSecure, getValue.
Setters
setDomain, setExpires, setHttpOnly, setMaxAge, setName, setPath, setSameSitePolicy, setSecure, setValue.
appliesToUri
Tests if cookie
should be sent to uri
.
(At the moment, this does not check that cookie
's domain matches
uri
, because it assumes that the caller has already done that.
But don't rely on that; it may change in the future.)
Since: 2.24
copy
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m Cookie | Returns: a copy of |
Copies cookie
.
Since: 2.24
domainMatches
Checks if the cookie
's domain and host
match in the sense that
cookie
should be sent when making a request to host
, or that
cookie
should be accepted when receiving a response from host
.
Since: 2.30
equal
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> Cookie |
|
-> m Bool | Returns: whether the cookies are equal. |
Tests if cookie1
and cookie2
are equal.
Note that currently, this does not check that the cookie domains match. This may change in the future.
Since: 2.24
free
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m () |
Frees cookie
Since: 2.24
getDomain
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m Text | Returns: |
Gets cookie
's domain
Since: 2.32
getExpires
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m (Maybe Date) | Returns: |
Gets cookie
's expiration time.
Since: 2.32
getHttpOnly
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m Bool | Returns: |
Gets cookie
's HttpOnly attribute
Since: 2.32
getName
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m Text | Returns: |
Gets cookie
's name
Since: 2.32
getPath
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m Text | Returns: |
Gets cookie
's path
Since: 2.32
getSameSitePolicy
cookieGetSameSitePolicy Source #
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m SameSitePolicy | Returns: a |
No description available in the introspection data.
Since: 2.70
getSecure
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m Bool | Returns: |
Gets cookie
's secure attribute
Since: 2.32
getValue
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m Text | Returns: |
Gets cookie
's value
Since: 2.32
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Text |
|
-> Text |
|
-> Text |
|
-> Int32 |
|
-> m Cookie | Returns: a new |
Creates a new Cookie
with the given attributes. (Use
cookieSetSecure
and cookieSetHttpOnly
if you
need to set those attributes on the returned cookie.)
If domain
starts with ".", that indicates a domain (which matches
the string after the ".", or any hostname that has domain
as a
suffix). Otherwise, it is a hostname and must match exactly.
maxAge
is used to set the "expires" attribute on the cookie; pass
-1 to not include the attribute (indicating that the cookie expires
with the current session), 0 for an already-expired cookie, or a
lifetime in seconds. You can use the constants
COOKIE_MAX_AGE_ONE_HOUR
, COOKIE_MAX_AGE_ONE_DAY
,
COOKIE_MAX_AGE_ONE_WEEK
and COOKIE_MAX_AGE_ONE_YEAR
(or
multiples thereof) to calculate this value. (If you really care
about setting the exact time that the cookie will expire, use
cookieSetExpires
.)
Since: 2.24
parse
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> URI |
|
-> m (Maybe Cookie) | Returns: a new |
Parses header
and returns a Cookie
. (If header
contains
multiple cookies, only the first one will be parsed.)
If header
does not have "path" or "domain" attributes, they will
be defaulted from origin
. If origin
is Nothing
, path will default
to "/", but domain will be left as Nothing
. Note that this is not a
valid state for a Cookie
, and you will need to fill in some
appropriate string for the domain if you want to actually make use
of the cookie.
Since: 2.24
setDomain
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> Text |
|
-> m () |
Sets cookie
's domain to domain
Since: 2.24
setExpires
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> Date |
|
-> m () |
Sets cookie
's expiration time to expires
. If expires
is Nothing
,
cookie
will be a session cookie and will expire at the end of the
client's session.
(This sets the same property as cookieSetMaxAge
.)
Since: 2.24
setHttpOnly
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> Bool |
|
-> m () |
Sets cookie
's HttpOnly attribute to httpOnly
. If True
, cookie
will be marked as "http only", meaning it should not be exposed to
web page scripts or other untrusted code.
Since: 2.24
setMaxAge
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> Int32 |
|
-> m () |
Sets cookie
's max age to maxAge
. If maxAge
is -1, the cookie
is a session cookie, and will expire at the end of the client's
session. Otherwise, it is the number of seconds until the cookie
expires. You can use the constants COOKIE_MAX_AGE_ONE_HOUR
,
COOKIE_MAX_AGE_ONE_DAY
, COOKIE_MAX_AGE_ONE_WEEK
and
COOKIE_MAX_AGE_ONE_YEAR
(or multiples thereof) to calculate
this value. (A value of 0 indicates that the cookie should be
considered already-expired.)
(This sets the same property as cookieSetExpires
.)
Since: 2.24
setName
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> Text |
|
-> m () |
Sets cookie
's name to name
Since: 2.24
setPath
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> Text |
|
-> m () |
Sets cookie
's path to path
Since: 2.24
setSameSitePolicy
cookieSetSameSitePolicy Source #
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> SameSitePolicy |
|
-> m () |
When used in conjunction with cookieJarGetCookieListWithSameSiteInfo
this
sets the policy of when this cookie should be exposed.
Since: 2.70
setSecure
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> Bool |
|
-> m () |
Sets cookie
's secure attribute to secure
. If True
, cookie
will
only be transmitted from the client to the server over secure
(https) connections.
Since: 2.24
setValue
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> Text |
|
-> m () |
Sets cookie
's value to value
Since: 2.24
toCookieHeader
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m Text | Returns: the header |
Serializes cookie
in the format used by the Cookie header (ie, for
returning a cookie from a Session
to a server).
Since: 2.24
toSetCookieHeader
cookieToSetCookieHeader Source #
:: (HasCallStack, MonadIO m) | |
=> Cookie |
|
-> m Text | Returns: the header |
Serializes cookie
in the format used by the Set-Cookie header
(ie, for sending a cookie from a Server
to a client).
Since: 2.24
Properties
domain
the "domain" attribute, or else the hostname that the cookie came from.
clearCookieDomain :: MonadIO m => Cookie -> m () Source #
Set the value of the “domain
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#domain
getCookieDomain :: MonadIO m => Cookie -> m (Maybe Text) Source #
Get the value of the “domain
” field.
When overloading is enabled, this is equivalent to
get
cookie #domain
setCookieDomain :: MonadIO m => Cookie -> CString -> m () Source #
Set the value of the “domain
” field.
When overloading is enabled, this is equivalent to
set
cookie [ #domain:=
value ]
expires
the cookie expiration time, or Nothing
for a session cookie
clearCookieExpires :: MonadIO m => Cookie -> m () Source #
Set the value of the “expires
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#expires
getCookieExpires :: MonadIO m => Cookie -> m (Maybe Date) Source #
Get the value of the “expires
” field.
When overloading is enabled, this is equivalent to
get
cookie #expires
setCookieExpires :: MonadIO m => Cookie -> Ptr Date -> m () Source #
Set the value of the “expires
” field.
When overloading is enabled, this is equivalent to
set
cookie [ #expires:=
value ]
httpOnly
True
if the cookie should not be exposed to scripts
getCookieHttpOnly :: MonadIO m => Cookie -> m Bool Source #
Get the value of the “http_only
” field.
When overloading is enabled, this is equivalent to
get
cookie #httpOnly
setCookieHttpOnly :: MonadIO m => Cookie -> Bool -> m () Source #
Set the value of the “http_only
” field.
When overloading is enabled, this is equivalent to
set
cookie [ #httpOnly:=
value ]
name
the cookie name
clearCookieName :: MonadIO m => Cookie -> m () Source #
Set the value of the “name
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#name
getCookieName :: MonadIO m => Cookie -> m (Maybe Text) Source #
Get the value of the “name
” field.
When overloading is enabled, this is equivalent to
get
cookie #name
setCookieName :: MonadIO m => Cookie -> CString -> m () Source #
Set the value of the “name
” field.
When overloading is enabled, this is equivalent to
set
cookie [ #name:=
value ]
path
the "path" attribute, or Nothing
clearCookiePath :: MonadIO m => Cookie -> m () Source #
Set the value of the “path
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#path
getCookiePath :: MonadIO m => Cookie -> m (Maybe Text) Source #
Get the value of the “path
” field.
When overloading is enabled, this is equivalent to
get
cookie #path
setCookiePath :: MonadIO m => Cookie -> CString -> m () Source #
Set the value of the “path
” field.
When overloading is enabled, this is equivalent to
set
cookie [ #path:=
value ]
secure
True
if the cookie should only be tranferred over SSL
getCookieSecure :: MonadIO m => Cookie -> m Bool Source #
Get the value of the “secure
” field.
When overloading is enabled, this is equivalent to
get
cookie #secure
setCookieSecure :: MonadIO m => Cookie -> Bool -> m () Source #
Set the value of the “secure
” field.
When overloading is enabled, this is equivalent to
set
cookie [ #secure:=
value ]
value
the cookie value
clearCookieValue :: MonadIO m => Cookie -> m () Source #
Set the value of the “value
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#value
getCookieValue :: MonadIO m => Cookie -> m (Maybe Text) Source #
Get the value of the “value
” field.
When overloading is enabled, this is equivalent to
get
cookie #value
setCookieValue :: MonadIO m => Cookie -> CString -> m () Source #
Set the value of the “value
” field.
When overloading is enabled, this is equivalent to
set
cookie [ #value:=
value ]