sscgi-0.2.0: Simple SCGI Library

Safe HaskellNone

Network.SCGI

Synopsis

Documentation

runRequestSource

Arguments

:: MonadIO m 
=> Handle

the handle connected to the web server (from accept)

-> (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.

headerSource

Arguments

:: Monad m 
=> ByteString

the header name (key)

-> SCGIT m (Maybe ByteString)

the header value if found

Lookup a request header.

allHeadersSource

Arguments

:: 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.

methodSource

Arguments

:: 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.

pathSource

Arguments

:: 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.

setHeaderSource

Arguments

:: Monad m 
=> ByteString

the header name (key)

-> ByteString

the header value

-> SCGIT m () 

Set a response header.

data Response Source

Constructors

Response Status Body