| Safe Haskell | None |
|---|
Network.HTTP.Client.Cookies
Description
This module implements the algorithms described in RFC 6265 for the Network.HTTP.Conduit library.
- slash :: Integral a => a
- isIpAddress :: ByteString -> Bool
- domainMatches :: ByteString -> ByteString -> Bool
- defaultPath :: Request -> ByteString
- pathMatches :: ByteString -> ByteString -> Bool
- createCookieJar :: [Cookie] -> CookieJar
- destroyCookieJar :: CookieJar -> [Cookie]
- insertIntoCookieJar :: Cookie -> CookieJar -> CookieJar
- removeExistingCookieFromCookieJar :: Cookie -> CookieJar -> (Maybe Cookie, CookieJar)
- rejectPublicSuffixes :: Bool
- isPublicSuffix :: ByteString -> Bool
- evictExpiredCookies :: CookieJar -> UTCTime -> CookieJar
- insertCookiesIntoRequest :: Request -> CookieJar -> UTCTime -> (Request, CookieJar)
- computeCookieString :: Request -> CookieJar -> UTCTime -> Bool -> (ByteString, CookieJar)
- updateCookieJar :: Response a -> Request -> UTCTime -> CookieJar -> (CookieJar, Response a)
- receiveSetCookie :: SetCookie -> Request -> UTCTime -> Bool -> CookieJar -> CookieJar
- insertCheckedCookie :: Cookie -> CookieJar -> Bool -> CookieJar
- generateCookie :: SetCookie -> Request -> UTCTime -> Bool -> Maybe Cookie
Documentation
isIpAddress :: ByteString -> BoolSource
domainMatches :: ByteString -> ByteString -> BoolSource
This corresponds to the subcomponent algorithm entitled "Domain Matching" detailed in section 5.1.3
defaultPath :: Request -> ByteStringSource
This corresponds to the subcomponent algorithm entitled "Paths" detailed in section 5.1.4
pathMatches :: ByteString -> ByteString -> BoolSource
This corresponds to the subcomponent algorithm entitled "Path-Match" detailed in section 5.1.4
createCookieJar :: [Cookie] -> CookieJarSource
destroyCookieJar :: CookieJar -> [Cookie]Source
rejectPublicSuffixes :: BoolSource
Are we configured to reject cookies for domains such as "com"?
Arguments
| :: CookieJar | Input cookie jar |
| -> UTCTime | Value that should be used as "now" |
| -> CookieJar | Filtered cookie jar |
This corresponds to the eviction algorithm described in Section 5.3 "Storage Model"
insertCookiesIntoRequestSource
Arguments
| :: Request | The request to insert into |
| -> CookieJar | Current cookie jar |
| -> UTCTime | Value that should be used as "now" |
| -> (Request, CookieJar) | (Ouptut request, Updated cookie jar (last-access-time is updated)) |
This applies the computeCookieString to a given Request
Arguments
| :: Request | Input request |
| -> CookieJar | Current cookie jar |
| -> UTCTime | Value that should be used as "now" |
| -> Bool | Whether or not this request is coming from an "http" source (not javascript or anything like that) |
| -> (ByteString, CookieJar) | (Contents of a "Cookie" header, Updated cookie jar (last-access-time is updated)) |
This corresponds to the algorithm described in Section 5.4 "The Cookie Header"
Arguments
| :: Response a | Response received from server |
| -> Request | Request which generated the response |
| -> UTCTime | Value that should be used as "now" |
| -> CookieJar | Current cookie jar |
| -> (CookieJar, Response a) | (Updated cookie jar with cookies from the Response, The response stripped of any "Set-Cookie" header) |
This applies receiveSetCookie to a given Response
Arguments
| :: SetCookie | The |
| -> Request | The request that originated the response that yielded the |
| -> UTCTime | Value that should be used as "now" |
| -> Bool | Whether or not this request is coming from an "http" source (not javascript or anything like that) |
| -> CookieJar | Input cookie jar to modify |
| -> CookieJar | Updated cookie jar |
This corresponds to the algorithm described in Section 5.3 "Storage Model"
This function consists of calling generateCookie followed by insertCheckedCookie.
Use this function if you plan to do both in a row.
generateCookie and insertCheckedCookie are only provided for more fine-grained control.
Arguments
| :: Cookie | The |
| -> CookieJar | Input cookie jar to modify |
| -> Bool | Whether or not this request is coming from an "http" source (not javascript or anything like that) |
| -> CookieJar | Updated (or not) cookie jar |
Insert a cookie created by generateCookie into the cookie jar (or not if it shouldn't be allowed in)
Arguments
| :: SetCookie | The |
| -> Request | The request that originated the response that yielded the |
| -> UTCTime | Value that should be used as "now" |
| -> Bool | Whether or not this request is coming from an "http" source (not javascript or anything like that) |
| -> Maybe Cookie | The optional output cookie |
Turn a SetCookie into a Cookie, if it is valid