Copyright | Andy Gill |
---|---|
License | BSD3 |
Maintainer | Andy Gill <andygill@ku.edu> |
Stability | unstable |
Portability | GHC |
Safe Haskell | None |
Language | Haskell98 |
A trivial web server.
This web server promotes a Request to IO Response function into a local web server. The user can decide how to interpret the requests, and the library is intended for implementing Ajax APIs.
initServerLazy (and assocated refactorings), and Chunking support was written by Henning Thielemann. Handling of POST-based payloads was been written by Brandon Moore. initServerBind support was written by John Van Enk.
- type Server = ()
- initServer :: Int -> (Request -> IO Response) -> IO Server
- initServerLazy :: Int -> Int -> (Request -> IO Response) -> IO Server
- initServerBind :: Int -> HostAddress -> (Request -> IO Response) -> IO Server
- data Request = Request {}
- data Response = Response {}
- queryToArguments :: String -> [(String, String)]
- addCache :: Int -> (String, String)
- noCache :: (String, String)
- contentType :: String -> (String, String)
Documentation
:: Int | The port number |
-> (Request -> IO Response) | The functionality of the Server |
-> IO Server | A token for the Server |
This server transfers documents as one parcel, using the content-length header.
:: Int | Chunk size |
-> Int | The port number |
-> (Request -> IO Response) | The functionality of the Server |
-> IO Server | A token for the Server |
This server transfers documents in chunked mode and without content-length header. This way you can ship infinitely big documents. It inserts the transfer encoding header for you.
:: Int | The port number |
-> HostAddress | The host address |
-> (Request -> IO Response) | The functionality of the Server |
-> IO Server | A token for the Server |
This server transfers documents as one parcel, using the content-length header, and takes an additional
queryToArguments :: String -> [(String, String)] Source
Takes an escaped query, optionally starting with ?
, and returns an unescaped index-value list.
contentType :: String -> (String, String) Source