webserver-0.1.0: HTTP server library

Network.Web.Server

Description

A library for HTTP server.

Synopsis

Documentation

connection :: Handle -> WebServer -> WebConfig -> IO ()Source

A function to run an WebServer. Handle should be mode by converting an accepted socket. Keep-alive / termination of HTTP 1.0 and HTTP 1.1 is correctly handled. So, WebServer need not to handle the Connection: header in response. The Date: header is automatically added in response.

type WebServer = Maybe Request -> IO ResponseSource

The type for HTTP server.

data WebConfig Source

The configuration for connection.

Constructors

WebConfig 

Fields

closedHook :: String -> IO ()

A hook to be called when an HTTP connection is closed.

accessHook :: String -> IO ()

A hook to be called when access succeeds.

errorHook :: String -> IO ()

A hook to be called when an access error occurs.

fatalErrorHook :: String -> IO ()

A hook to be called when a fatal error occurs.

connectionTimer :: Int

A time to unblock receiving an HTTP request in seconds.