happstack-server-7.7.1.1: Web related tools and services.
Safe HaskellNone
LanguageHaskell2010

Happstack.Server.Internal.Cookie

Synopsis

Documentation

data Cookie Source #

a type for HTTP cookies. Usually created using mkCookie.

Instances

Instances details
Eq Cookie Source # 
Instance details

Defined in Happstack.Server.Internal.Cookie

Methods

(==) :: Cookie -> Cookie -> Bool #

(/=) :: Cookie -> Cookie -> Bool #

Data Cookie Source # 
Instance details

Defined in Happstack.Server.Internal.Cookie

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Cookie -> c Cookie #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Cookie #

toConstr :: Cookie -> Constr #

dataTypeOf :: Cookie -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Cookie) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Cookie) #

gmapT :: (forall b. Data b => b -> b) -> Cookie -> Cookie #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Cookie -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Cookie -> r #

gmapQ :: (forall d. Data d => d -> u) -> Cookie -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Cookie -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Cookie -> m Cookie #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Cookie -> m Cookie #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Cookie -> m Cookie #

Read Cookie Source # 
Instance details

Defined in Happstack.Server.Internal.Cookie

Show Cookie Source # 
Instance details

Defined in Happstack.Server.Internal.Cookie

MonadReader RqEnv RqData Source # 
Instance details

Defined in Happstack.Server.RqData

Methods

ask :: RqData RqEnv #

local :: (RqEnv -> RqEnv) -> RqData a -> RqData a #

reader :: (RqEnv -> a) -> RqData a #

data CookieLife Source #

Specify the lifetime of a cookie.

Note that we always set the max-age and expires headers because internet explorer does not honor max-age. You can specific MaxAge or Expires and the other will be calculated for you. Choose which ever one makes your life easiest.

Constructors

Session

session cookie - expires when browser is closed

MaxAge Int

life time of cookie in seconds

Expires UTCTime

cookie expiration date

Expired

cookie already expired

data SameSite Source #

Options for specifying third party cookie behaviour.

Note that most or all web clients require the cookie to be secure if "none" is specified.

Constructors

SameSiteLax

The cookie is sent in first party contexts as well as linked requests initiated from other contexts.

SameSiteStrict

The cookie is sent in first party contexts only.

SameSiteNone

The cookie is sent in first as well as third party contexts if the cookie is secure.

SameSiteNoValue

The default; used if you do not wish a SameSite attribute present at all.

Instances

Instances details
Eq SameSite Source # 
Instance details

Defined in Happstack.Server.Internal.Cookie

Data SameSite Source # 
Instance details

Defined in Happstack.Server.Internal.Cookie

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> SameSite -> c SameSite #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c SameSite #

toConstr :: SameSite -> Constr #

dataTypeOf :: SameSite -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c SameSite) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c SameSite) #

gmapT :: (forall b. Data b => b -> b) -> SameSite -> SameSite #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> SameSite -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> SameSite -> r #

gmapQ :: (forall d. Data d => d -> u) -> SameSite -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> SameSite -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> SameSite -> m SameSite #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> SameSite -> m SameSite #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> SameSite -> m SameSite #

Ord SameSite Source # 
Instance details

Defined in Happstack.Server.Internal.Cookie

Read SameSite Source # 
Instance details

Defined in Happstack.Server.Internal.Cookie

Show SameSite Source # 
Instance details

Defined in Happstack.Server.Internal.Cookie

mkCookie Source #

Arguments

:: String

cookie name

-> String

cookie value

-> Cookie 

Creates a cookie with a default version of 1, empty domain, a path of "/", secure == False, httpOnly == False and sameSite == SameSiteNoValue

see also: addCookie

mkCookieHeader :: Maybe (Int, UTCTime) -> Cookie -> String Source #

Set a Cookie in the Result. The values are escaped as per RFC 2109, but some browsers may have buggy support for cookies containing e.g. '"' or ' '.

Also, it seems that chrome, safari, and other webkit browsers do not like cookies which have double quotes around the domain and reject/ignore the cookie. So, we no longer quote the domain.

internet explorer does not honor the max-age directive so we set both max-age and expires.

See CookieLife and calcLife for a convenient way of calculating the first argument to this function.

getCookies :: MonadFail m => ByteString -> m [Cookie] Source #

Get all cookies from the HTTP request. The cookies are ordered per RFC from the most specific to the least specific. Multiple cookies with the same name are allowed to exist.

getCookie :: MonadFail m => String -> ByteString -> m Cookie Source #

Get the most specific cookie with the given name. Fails if there is no such cookie or if the browser did not escape cookies in a proper fashion. Browser support for escaping cookies properly is very diverse.

parseCookies :: String -> Either String [Cookie] Source #

Not an supported api. Takes a cookie header and returns either a String error message or an array of parsed cookies

cookiesParser :: GenParser Char st [Cookie] Source #

not a supported api. A parser for RFC 2109 cookies