Network.Wai.Handler.Warp
Contents
Description
A fast, light-weight HTTP server handler for WAI. Some random notes (a FAQ, if you will):
- When a
ResponseFileindicates a file which does not exist, an exception is thrown. This will close the connection to the client as well. You should handle file existance checks at the application level.
- run :: Port -> Application -> IO ()
- runEx :: (SomeException -> IO ()) -> Port -> Application -> IO ()
- serveConnections :: (SomeException -> IO ()) -> Port -> Application -> Socket -> IO ()
- runSettings :: Settings -> Application -> IO ()
- data Settings
- defaultSettings :: Settings
- settingsPort :: Settings -> Int
- settingsOnException :: Settings -> SomeException -> IO ()
- settingsTimeout :: Settings -> Int
- type Port = Int
- data InvalidRequest
- sendResponse :: Handle -> Request -> HttpVersion -> Socket -> Response -> IO Bool
- parseRequest :: Port -> SockAddr -> Iteratee ByteString IO (Enumeratee ByteString ByteString IO a, Request)
Run a Warp server
run :: Port -> Application -> IO ()Source
Run an Application on the given port, ignoring all exceptions.
runEx :: (SomeException -> IO ()) -> Port -> Application -> IO ()Source
Run an Application on the given port, with the given exception handler.
Please note that you will also receive InvalidRequest exceptions.
serveConnections :: (SomeException -> IO ()) -> Port -> Application -> Socket -> IO ()Source
Runs a server, listening on the given socket. The user is responsible for
closing the socket after runWithSocket completes. You must also supply a
Port argument for use in the serverPort record; however, this field is
only used for informational purposes. If you are in fact listening on a
non-TCP socket, this can be a ficticious value.
Run a Warp server with full settings control
runSettings :: Settings -> Application -> IO ()Source
settingsPort :: Settings -> IntSource
settingsOnException :: Settings -> SomeException -> IO ()Source
settingsTimeout :: Settings -> IntSource
seconds
Datatypes
data InvalidRequest Source
Utility functions for other packages
sendResponse :: Handle -> Request -> HttpVersion -> Socket -> Response -> IO BoolSource
parseRequest :: Port -> SockAddr -> Iteratee ByteString IO (Enumeratee ByteString ByteString IO a, Request)Source