Safe Haskell | None |
---|
- data SCGIT m a
- type SCGI = SCGIT IO
- runRequest :: MonadIO m => Handle -> (Body -> SCGIT m Response) -> m ()
- header :: Monad m => ByteString -> SCGIT m (Maybe ByteString)
- allHeaders :: Monad m => SCGIT m [(ByteString, ByteString)]
- method :: Monad m => SCGIT m (Maybe ByteString)
- path :: Monad m => SCGIT m (Maybe ByteString)
- setHeader :: Monad m => ByteString -> ByteString -> SCGIT m ()
- type Headers = Map (CI ByteString) ByteString
- type Body = ByteString
- type Status = ByteString
- data Response = Response Status Body
Documentation
:: MonadIO m | |
=> Handle | the handle connected to the web server (from |
-> (Body -> 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 |
Lookup 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.
:: 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.
type Headers = Map (CI ByteString) ByteStringSource
type Body = ByteStringSource
type Status = ByteStringSource