-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A fast, light-weight web server for WAI applications. -- -- The premier WAI handler. For more information, see -- http://steve.vinoski.net/blog/2011/05/01/warp-a-haskell-web-server/. -- -- Changelog -- --
-- defaultSettings { settingsTimeout = 20 }
--
data Settings
Settings :: Int -> HostPreference -> (Maybe Request -> SomeException -> IO ()) -> (SomeException -> Response) -> (SockAddr -> IO Bool) -> (SockAddr -> IO ()) -> Int -> (Request -> IO (Maybe (Source IO ByteString -> Connection -> IO ()))) -> Maybe Manager -> Int -> IO () -> Bool -> Settings
-- | Port to listen on. Default value: 3000
-- | Deprecated: Use setPort instead
settingsPort :: Settings -> Int
-- | Default value: HostIPv4
-- | Deprecated: Use setHost instead
settingsHost :: Settings -> HostPreference
-- | 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.
-- | Deprecated: Use setOnException instead
settingsOnException :: Settings -> Maybe Request -> SomeException -> IO ()
-- | A function to create Response when an exception occurs.
--
-- Default: 500, text/plain, "Something went wrong"
--
-- Since 2.0.3
-- | Deprecated: Use setOnExceptionResponse instead
settingsOnExceptionResponse :: Settings -> SomeException -> Response
-- | 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.
-- | Deprecated: Use setOnOpen instead
settingsOnOpen :: Settings -> SockAddr -> IO Bool
-- | What to do when a connection is close. Default: do nothing.
-- | Deprecated: Use setOnClose instead
settingsOnClose :: Settings -> SockAddr -> IO ()
-- | Timeout value in seconds. Default value: 30
-- | Deprecated: Use setTimeout instead
settingsTimeout :: Settings -> Int
-- | Deprecated: Use setIntercept instead
settingsIntercept :: Settings -> Request -> IO (Maybe (Source IO ByteString -> Connection -> IO ()))
-- | Use an existing timeout manager instead of spawning a new one. If
-- used, settingsTimeout is ignored. Default is Nothing
-- | Deprecated: Use setManager instead
settingsManager :: Settings -> Maybe Manager
-- | Cache duratoin time of file descriptors in seconds. 0 means that the
-- cache mechanism is not used. Default value: 10
-- | Deprecated: Use setFdCacheDuration instead
settingsFdCacheDuration :: Settings -> Int
-- | 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
-- | Deprecated: Use setBeforeMainLoop instead
settingsBeforeMainLoop :: Settings -> IO ()
-- | Perform no parsing on the rawPathInfo.
--
-- This is useful for writing HTTP proxies.
--
-- Default: False
--
-- Since 2.0.3
-- | Deprecated: Use setNoParsePath instead
settingsNoParsePath :: Settings -> Bool
getOnOpen :: Settings -> SockAddr -> IO Bool
getOnClose :: Settings -> SockAddr -> IO ()
getOnException :: Settings -> Maybe Request -> SomeException -> IO ()
-- | A fast, light-weight HTTP server handler for WAI.
module Network.Wai.Handler.Warp
-- | Run an Application on the given port. This calls
-- runSettings with defaultSettings.
run :: Port -> Application -> IO ()
-- | Run an Application with the given Settings.
runSettings :: Settings -> Application -> IO ()
-- | Same as runSettings, but uses a user-supplied socket instead of
-- opening one. This allows the user to provide, for example, Unix named
-- socket, which can be used when reverse HTTP proxying into your
-- application.
--
-- Note that the settingsPort will still be passed to
-- Applications via the serverPort record.
runSettingsSocket :: Settings -> Socket -> Application -> IO ()
-- | Allows you to provide a function which will return a
-- Connection. In cases where creating the Connection can
-- be expensive, this allows the expensive computations to be performed
-- in a separate thread instead of the main server loop.
--
-- Since 1.3.5
runSettingsConnection :: Settings -> IO (Connection, SockAddr) -> Application -> IO ()
runSettingsConnectionMaker :: Settings -> IO (IO Connection, SockAddr) -> Application -> IO ()
-- | Allows you to provide a function which will return a function which
-- will return Connection.
--
-- Since 2.1.4
runSettingsConnectionMakerSecure :: Settings -> IO (IO (Connection, Bool), SockAddr) -> Application -> IO ()
-- | 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 record syntax to modify individual records.
-- For example:
--
--
-- defaultSettings { settingsTimeout = 20 }
--
data Settings
-- | The default settings for the Warp server. See the individual settings
-- for the default value.
defaultSettings :: Settings
-- | Port to listen on. Default value: 3000
--
-- Since 2.1.0
setPort :: Int -> Settings -> Settings
-- | Interface to bind to. Default value: HostIPv4
--
-- Since 2.1.0
setHost :: HostPreference -> Settings -> Settings
-- | 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.
--
-- Since 2.1.0
setOnException :: (Maybe Request -> SomeException -> IO ()) -> Settings -> Settings
-- | A function to create Response when an exception occurs.
--
-- Default: 500, text/plain, "Something went wrong"
--
-- Since 2.1.0
setOnExceptionResponse :: (SomeException -> Response) -> Settings -> Settings
-- | 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.
--
-- Since 2.1.0
setOnOpen :: (SockAddr -> IO Bool) -> Settings -> Settings
-- | What to do when a connection is close. Default: do nothing.
--
-- Since 2.1.0
setOnClose :: (SockAddr -> IO ()) -> Settings -> Settings
-- | Timeout value in seconds. Default value: 30
--
-- Since 2.1.0
setTimeout :: Int -> Settings -> Settings
-- | Register some intercept handler to deal with specific requests. Prime
-- use case: websockets.
--
-- Default: always return Nothing.
--
-- Since 2.1.0
setIntercept :: (Request -> IO (Maybe (Source IO ByteString -> Connection -> IO ()))) -> Settings -> Settings
-- | Use an existing timeout manager instead of spawning a new one. If
-- used, settingsTimeout is ignored.
--
-- Since 2.1.0
setManager :: Manager -> Settings -> Settings
-- | Cache duratoin time of file descriptors in seconds. 0 means that the
-- cache mechanism is not used. Default value: 10
setFdCacheDuration :: Int -> Settings -> Settings
-- | 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 2.1.0
setBeforeMainLoop :: IO () -> Settings -> Settings
-- | Perform no parsing on the rawPathInfo.
--
-- This is useful for writing HTTP proxies.
--
-- Default: False
--
-- Since 2.1.0
setNoParsePath :: Bool -> Settings -> Settings
-- | Get the listening port.
--
-- Since 2.1.1
getPort :: Settings -> Int
-- | Get the interface to bind to.
--
-- Since 2.1.1
getHost :: Settings -> HostPreference
-- | Port to listen on. Default value: 3000
-- | Deprecated: Use setPort instead
settingsPort :: Settings -> Int
-- | Default value: HostIPv4
-- | Deprecated: Use setHost instead
settingsHost :: Settings -> HostPreference
-- | 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.
-- | Deprecated: Use setOnException instead
settingsOnException :: Settings -> Maybe Request -> SomeException -> IO ()
-- | A function to create Response when an exception occurs.
--
-- Default: 500, text/plain, "Something went wrong"
--
-- Since 2.0.3
-- | Deprecated: Use setOnExceptionResponse instead
settingsOnExceptionResponse :: Settings -> SomeException -> Response
-- | 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.
-- | Deprecated: Use setOnOpen instead
settingsOnOpen :: Settings -> SockAddr -> IO Bool
-- | What to do when a connection is close. Default: do nothing.
-- | Deprecated: Use setOnClose instead
settingsOnClose :: Settings -> SockAddr -> IO ()
-- | Timeout value in seconds. Default value: 30
-- | Deprecated: Use setTimeout instead
settingsTimeout :: Settings -> Int
-- | Deprecated: Use setIntercept instead
settingsIntercept :: Settings -> Request -> IO (Maybe (Source IO ByteString -> Connection -> IO ()))
-- | Use an existing timeout manager instead of spawning a new one. If
-- used, settingsTimeout is ignored. Default is Nothing
-- | Deprecated: Use setManager instead
settingsManager :: Settings -> Maybe Manager
-- | Cache duratoin time of file descriptors in seconds. 0 means that the
-- cache mechanism is not used. Default value: 10
-- | Deprecated: Use setFdCacheDuration instead
settingsFdCacheDuration :: Settings -> Int
-- | 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
-- | Deprecated: Use setBeforeMainLoop instead
settingsBeforeMainLoop :: Settings -> IO ()
-- | Perform no parsing on the rawPathInfo.
--
-- This is useful for writing HTTP proxies.
--
-- Default: False
--
-- Since 2.0.3
-- | Deprecated: Use setNoParsePath instead
settingsNoParsePath :: Settings -> Bool
-- | Default implementation of settingsOnExceptionResponse for the
-- debugging purpose. 500, text/plain, a showed exception.
exceptionResponseForDebug :: SomeException -> Response
-- | Apply the logic provided by defaultExceptionHandler to
-- determine if an exception should be shown or not. The goal is to hide
-- exceptions which occur under the normal course of the web server
-- running.
--
-- Since 2.1.3
defaultShouldDisplayException :: SomeException -> Bool
-- | Which host to bind.
--
-- Note: The IsString instance recognizes the following special
-- values:
--
--