sscgi-0.3.0: Simple SCGI Library

Safe HaskellNone

Network.SCGI

Synopsis

Documentation

runRequestSource

Arguments

:: MonadCatchIO m 
=> Handle

the handle connected to the web server (from accept)

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

Look up 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.

body :: Monad m => SCGIT m ByteStringSource

Return the request body.

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.

responseHeaderSource

Arguments

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

data Response Source

Constructors

Response Status Body