- 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]
|:: MonadCatchIO m|
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|
the header name (key)
|-> SCGIT m (Maybe ByteString)|
the header value if found
Look up a request header.
Return all request headers as a list in the format they were received from the web server.
Get the request method (GET, POST, etc.). You could look the header up yourself, but this normalizes the method name to uppercase.
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.
Set a response header.
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).