warp- A fast, light-weight web server for WAI applications.

Safe HaskellNone




data Settings Source

Various Warp server settings. This is purposely kept as an abstract data type so that new settings can be added without breaking backwards compatibility. In order to create a Settings value, use defaultSettings and the various 'set' functions to modify individual fields. For example:

setTimeout 20 defaultSettings




settingsPort :: Int

Deprecated: Use setPort instead

Port to listen on. Default value: 3000

settingsHost :: HostPreference

Deprecated: Use setHost instead

Default value: HostIPv4

settingsOnException :: Maybe Request -> SomeException -> IO ()

Deprecated: Use setOnException instead

What to do with exceptions thrown by either the application or server. Default: ignore server-generated exceptions (see InvalidRequest) and print application-generated applications to stderr.

settingsOnExceptionResponse :: SomeException -> Response

Deprecated: Use setOnExceptionResponse instead

A function to create Response when an exception occurs.

Default: 500, text/plain, "Something went wrong"

Since 2.0.3

settingsOnOpen :: SockAddr -> IO Bool

Deprecated: Use setOnOpen instead

What to do when a connection is open. When False is returned, the connection is closed immediately. Otherwise, the connection is going on. Default: always returns True.

settingsOnClose :: SockAddr -> IO ()

Deprecated: Use setOnClose instead

What to do when a connection is close. Default: do nothing.

settingsTimeout :: Int

Deprecated: Use setTimeout instead

Timeout value in seconds. Default value: 30

settingsManager :: Maybe Manager

Deprecated: Use setManager instead

Use an existing timeout manager instead of spawning a new one. If used, settingsTimeout is ignored. Default is Nothing

settingsFdCacheDuration :: Int

Deprecated: Use setFdCacheDuration instead

Cache duratoin time of file descriptors in seconds. 0 means that the cache mechanism is not used. Default value: 10

settingsBeforeMainLoop :: IO ()

Deprecated: Use setBeforeMainLoop instead

Code to run after the listening socket is ready but before entering the main event loop. Useful for signaling to tests that they can start running, or to drop permissions after binding to a restricted port.

Default: do nothing.

Since 1.3.6

settingsFork :: ((forall a. IO a -> IO a) -> IO ()) -> IO ()

Code to fork a new thread to accept a connection.

This may be useful if you need OS bound threads, or if you wish to develop an alternative threading model.

Default: void . forkIOWithUnmask

Since 3.0.4

settingsNoParsePath :: Bool

Deprecated: Use setNoParsePath instead

Perform no parsing on the rawPathInfo.

This is useful for writing HTTP proxies.

Default: False

Since 2.0.3

settingsInstallShutdownHandler :: IO () -> IO ()
settingsServerName :: ByteString

Default server name if application does not set one.

Since 3.0.2

settingsMaximumBodyFlush :: Maybe Int

See setMaximumBodyFlush.

Since 3.0.3

settingsProxyProtocol :: ProxyProtocol

Specify usage of the PROXY protocol.

Since 3.0.5.

getOnOpen :: Settings -> SockAddr -> IO Bool Source

getOnClose :: Settings -> SockAddr -> IO () Source