Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
A server library for HTTP/0.9.
Synopsis
- run :: Connection -> Config -> Server -> IO ()
- data Config = Config {}
- allocSimpleConfig :: IO Config
- freeSimpleConfig :: Config -> IO ()
- type Server = Request -> Aux -> (Response -> [PushPromise] -> IO ()) -> IO ()
- data Request
- requestPath :: Request -> Maybe Path
- data Response
- responseNoBody :: Status -> ResponseHeaders -> Response
- responseFile :: Status -> ResponseHeaders -> FileSpec -> Response
- responseStreaming :: Status -> ResponseHeaders -> ((Builder -> IO ()) -> IO () -> IO ()) -> Response
- responseBuilder :: Status -> ResponseHeaders -> Builder -> Response
Runner
Runner arguments
Configuration for HTTP/3 or HQ.
allocSimpleConfig :: IO Config Source #
Allocating a simple configuration with a handle-based position reader and a locally allocated timeout manager.
freeSimpleConfig :: Config -> IO () Source #
Freeing a simple configration.
HQ server
type Server = Request -> Aux -> (Response -> [PushPromise] -> IO ()) -> IO () #
Server type. Server takes a HTTP request, should generate a HTTP response and push promises, then should give them to the sending function. The sending function would throw exceptions so that they can be logged.
The sending function must only be called once.
Request
Request from client.
Accessing request
requestPath :: Request -> Maybe Path #
Getting the path from a request.
Response
Response from server.
Creating response
responseNoBody :: Status -> ResponseHeaders -> Response #
Creating response without body.
responseFile :: Status -> ResponseHeaders -> FileSpec -> Response #
Creating response with file.
responseStreaming :: Status -> ResponseHeaders -> ((Builder -> IO ()) -> IO () -> IO ()) -> Response #
Creating response with streaming.
responseBuilder :: Status -> ResponseHeaders -> Builder -> Response #
Creating response with builder.