Hoogle Search
Within LTS Haskell 24.34 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
setInstallShutdownHandler :: (IO () -> IO ()) -> Settings -> Settingswarp Network.Wai.Handler.Warp A code to install shutdown handler. For instance, this code should set up a UNIX signal handler. The handler should call the first argument, which closes the listen socket, at shutdown. Example usage:
settings :: IO () -> Settings settings shutdownAction = setInstallShutdownHandler shutdownHandler defaultSettings where shutdownHandler closeSocket = void $ installHandler sigTERM (Catch $ shutdownAction >> closeSocket) Nothing
Note that by default, the graceful shutdown mode lasts indefinitely (see setGracefulShutdownTimeout). If you install a signal handler as above, upon receiving that signal, the custom shutdown action will run and all outstanding requests will be handled. You may instead prefer to do one or both of the following:- Only wait a finite amount of time for outstanding requests to complete, using setGracefulShutdownTimeout.
- Only catch one signal, so the second hard-kills the Warp server, using CatchOnce.
setLogger :: (Request -> Status -> Maybe Integer -> IO ()) -> Settings -> Settingswarp Network.Wai.Handler.Warp Setting a log function. Since 3.X.X
setManager :: Manager -> Settings -> Settingswarp Network.Wai.Handler.Warp Use an existing timeout manager instead of spawning a new one. If used, settingsTimeout is ignored. Since 2.1.0
setMaxBuilderResponseBufferSize :: Int -> Settings -> Settingswarp Network.Wai.Handler.Warp Set the maximum buffer size for sending Builder responses. Since 3.3.22
setMaxTotalHeaderLength :: Int -> Settings -> Settingswarp Network.Wai.Handler.Warp Set the maximum header size that Warp will tolerate when using HTTP/1.x. Since 3.3.8
setMaximumBodyFlush :: Maybe Int -> Settings -> Settingswarp Network.Wai.Handler.Warp The maximum number of bytes to flush from an unconsumed request body. By default, Warp does not flush the request body so that, if a large body is present, the connection is simply terminated instead of wasting time and bandwidth on transmitting it. However, some clients do not deal with that situation well. You can either change this setting to Nothing to flush the entire body in all cases, or in your application ensure that you always consume the entire request body. Default: 8192 bytes. Since 3.0.3
setNoParsePath :: Bool -> Settings -> Settingswarp Network.Wai.Handler.Warp Perform no parsing on the rawPathInfo. This is useful for writing HTTP proxies. Default: False Since 2.1.0
setOnClose :: (SockAddr -> IO ()) -> Settings -> Settingswarp Network.Wai.Handler.Warp What to do when a connection is closed. Default: do nothing. Since 2.1.0
setOnException :: (Maybe Request -> SomeException -> IO ()) -> Settings -> Settingswarp Network.Wai.Handler.Warp What to do with exceptions thrown by either the application or server. Default: defaultOnException Since 2.1.0
setOnExceptionResponse :: (SomeException -> Response) -> Settings -> Settingswarp Network.Wai.Handler.Warp A function to create a Response when an exception occurs. Default: defaultOnExceptionResponse Note that an application can handle its own exceptions without interfering with Warp:
myApp :: Application myApp request respond = innerApp `catch` onError where onError = respond . response500 request response500 :: Request -> SomeException -> Response response500 req someEx = responseLBS status500 -- ...
Since 2.1.0