Copyright | (c) Galois, Inc. 2007, 2008 |
---|---|
License | BSD3 |
Maintainer | diatchki@galois.com |
Stability | provisional |
Portability | |
Safe Haskell | None |
Language | Haskell98 |
- server :: HStream a => Handler a -> IO ()
- serverWith :: HStream a => Config -> Handler a -> IO ()
- type Handler a = SockAddr -> URL -> Request a -> IO (Response a)
- data Config = Config {}
- defaultConfig :: Config
- data Request a :: * -> * = Request {}
- data Response a :: * -> * = Response {
- rspCode :: ResponseCode
- rspReason :: String
- rspHeaders :: [Header]
- rspBody :: a
- data RequestMethod :: *
- module Network.HTTP.Headers
- module Network.HTTP.Server.Response
Documentation
server :: HStream a => Handler a -> IO () Source
Start a server with the default configuration, and the given handler. Requests are handled in separate threads.
serverWith :: HStream a => Config -> Handler a -> IO () Source
Start a server with the given configuration and handler. Requests are handled in separate threads.
type Handler a = SockAddr -> URL -> Request a -> IO (Response a) Source
Handlers invoked to process requests. The type parameter is for the type of the payload in the body. It is a variation on string of some sort (e.g., String, ByteString, etc.)
Server configuration.
defaultConfig :: Config Source
Some default options for a server: no logging output, listen on "localhost:8000".
data Request a :: * -> *
An HTTP Request.
The Show
instance of this type is used for message serialisation,
which means no body data is output.
Show (Request a) | |
HasHeaders (Request a) |
data Response a :: * -> *
An HTTP Response.
The Show
instance of this type is used for message serialisation,
which means no body data is output, additionally the output will
show an HTTP version of 1.1 instead of the actual version returned
by a server.
Response | |
|
Show (Response a) | |
HasHeaders (Response a) |
data RequestMethod :: *
The HTTP request method, to be used in the Request
object.
We are missing a few of the stranger methods, but these are
not really necessary until we add full TLS.
module Network.HTTP.Headers
module Network.HTTP.Server.Response