Safe Haskell | None |
---|
- data SCGIT m a
- type SCGI = SCGIT IO
- runRequest :: MonadCatchIO m => Handle -> SCGIT m Response -> m ()
- header :: Monad m => ByteString -> SCGIT m (Maybe ByteString)
- allHeaders :: Monad m => SCGIT m [(ByteString, ByteString)]
- body :: Monad m => SCGIT m ByteString
- method :: Monad m => SCGIT m (Maybe ByteString)
- path :: Monad m => SCGIT m (Maybe ByteString)
- setHeader :: Monad m => ByteString -> ByteString -> SCGIT m ()
- responseHeader :: Monad m => ByteString -> SCGIT m (Maybe ByteString)
- type Headers = Map (CI ByteString) ByteString
- type Body = ByteString
- type Status = ByteString
- data Response = Response Status Body
- negotiate :: Monad m => [ByteString] -> SCGIT m [ByteString]
Documentation
MonadTrans SCGIT | |
Monad m => MonadState Headers (SCGIT m) | |
Monad m => Monad (SCGIT m) | |
MonadCatchIO m => MonadCatchIO (SCGIT m) | |
MonadIO m => MonadIO (SCGIT m) | |
Monad m => MonadReader (Headers, Body) (SCGIT m) |
:: MonadCatchIO m | |
=> Handle | the handle connected to the web server (from |
-> SCGIT m Response | the action to run in the SCGI monad |
-> m () | nothing is returned, the result of the action is written back to the server |
Run a request in the SCGI monad.
:: Monad m | |
=> ByteString | the header name (key) |
-> SCGIT m (Maybe ByteString) | the header value if found |
Look up a request header.
:: Monad m | |
=> SCGIT m [(ByteString, ByteString)] | an association list of header: value pairs |
Return all request headers as a list in the format they were received from the web server.
body :: Monad m => SCGIT m ByteStringSource
Return the request body.
:: Monad m | |
=> SCGIT m (Maybe ByteString) | the method if found |
Get the request method (GET, POST, etc.). You could look the header up yourself, but this normalizes the method name to uppercase.
:: Monad m | |
=> SCGIT m (Maybe ByteString) | the path if found |
Get the requested path. According to the spec, this can be complex, and actual CGI implementations diverge from the spec. I've found this to work, even though it doesn't seem correct or intuitive.
:: Monad m | |
=> ByteString | the header name (key) |
-> ByteString | the header value |
-> SCGIT m () |
Set a response header.
:: Monad m | |
=> ByteString | the header name (key) |
-> SCGIT m (Maybe ByteString) |
Look up a response header (one set during this request). This is useful when you need to check if a header has been set already (in case you want to modify it, for example).
type Headers = Map (CI ByteString) ByteStringSource
type Body = ByteStringSource
type Status = ByteStringSource
negotiate :: Monad m => [ByteString] -> SCGIT m [ByteString]Source