- setCookie :: MonadSnap m => Cookie -> m ()
- lookupCookie :: MonadSnap m => ByteString -> m (Maybe Cookie)
- clearCookie :: MonadSnap m => ByteString -> m ()
- popPathTo :: MonadSnap m => (ByteString -> m a) -> m a
- ifTopDir :: MonadSnap m => m a -> m a
- ifTopFile :: MonadSnap m => m a -> m a
- newtype SessionKey = K Word64
- uniqueKey :: (Random k, Ord k) => Map k a -> IO k
Documentation
setCookie :: MonadSnap m => Cookie -> m ()Source
Sets a cookie in both the request and the response. This modifies the list of cookies in the request, so that later attempts to get cookies will find this one even within the same request.
lookupCookie :: MonadSnap m => ByteString -> m (Maybe Cookie)Source
Retrieves a cookie, looking first in the response map, and if not there, then in the request. This ensures that the most recently set cookie is retrieved.
clearCookie :: MonadSnap m => ByteString -> m ()Source
Clears a cookie. This involves setting the cookie to the empty string, with an expiration time in the past.
popPathTo :: MonadSnap m => (ByteString -> m a) -> m aSource
If there is another path component in the request path, pop it off, and pass it as a parameter to the handler.
ifTopDir :: MonadSnap m => m a -> m aSource
Ensure that we're at the top level of a request, and expect that it be a directory. As with standard HTTP behavior, if a path to a directory is given and the request URI doesn't end in a slash, then the user is redirected to a path ending in a slash.
ifTopFile :: MonadSnap m => m a -> m aSource
Ensure that we're at the top level of a request, and expect that it be a file. If a trailing slash is given, we pass on the request.
newtype SessionKey Source
Session keys are 64-bit integers with standard numeric type classes.