warp 3.2.25 → 3.2.26
raw patch · 5 files changed
+45/−10 lines, 5 filesdep ~network
Dependency ranges changed: network
Files
- ChangeLog.md +4/−0
- Network/Wai/Handler/Warp.hs +16/−0
- Network/Wai/Handler/Warp/Recv.hs +17/−8
- Network/Wai/Handler/Warp/Run.hs +7/−1
- warp.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 3.2.26++* Support network package version 3+ ## 3.2.25 * Removing Connection: and Transfer-Encoding: from HTTP/2
Network/Wai/Handler/Warp.hs view
@@ -296,6 +296,18 @@ -- void $ 'System.Posix.Signals.installHandler' 'System.Posix.Signals.sigTERM' ('System.Posix.Signals.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 custon 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+-- 'System.Posix.Signals.CatchOnce'.+-- -- Default: does not install any code. -- -- Since 3.0.1@@ -408,6 +420,10 @@ -- | Set the graceful shutdown timeout. A timeout of `Nothing' will -- wait indefinitely, and a number, if provided, will be treated as seconds -- to wait for requests to finish, before shutting down the server entirely.+--+-- Graceful shutdown mode is entered when the server socket is closed; see+-- 'setInstallShutdownHandler' for an example of how this could be done in+-- response to a UNIX signal. -- -- Since 3.2.8 setGracefulShutdownTimeout :: Maybe Int
Network/Wai/Handler/Warp/Recv.hs view
@@ -91,22 +91,31 @@ receive :: Socket -> BufferPool -> Recv receive sock pool = withBufferPool pool $ \ (ptr, size) -> do- let sock' = fdSocket sock- size' = fromIntegral size- fromIntegral <$> receiveloop sock' ptr size'+#if MIN_VERSION_network(3,0,0)+ fd <- fdSocket sock+#else+ let fd = fdSocket sock+#endif+ let size' = fromIntegral size+ fromIntegral <$> receiveloop fd ptr size' receiveBuf :: Socket -> RecvBuf-receiveBuf sock buf0 siz0 = loop buf0 siz0+receiveBuf sock buf0 siz0 = do+#if MIN_VERSION_network(3,0,0)+ fd <- fdSocket sock+#else+ let fd = fdSocket sock+#endif+ loop fd buf0 siz0 where- loop _ 0 = return True- loop buf siz = do+ loop _ _ 0 = return True+ loop fd buf siz = do n <- fromIntegral <$> receiveloop fd buf (fromIntegral siz) -- fixme: what should we do in the case of n == 0 if n == 0 then return False else- loop (buf `plusPtr` n) (siz - n)- fd = fdSocket sock+ loop fd (buf `plusPtr` n) (siz - n) receiveloop :: CInt -> Ptr Word8 -> CSize -> IO CInt receiveloop sock ptr size = do
Network/Wai/Handler/Warp/Run.hs view
@@ -536,7 +536,13 @@ #if WINDOWS setSocketCloseOnExec _ = return () #else-setSocketCloseOnExec socket = F.setFileCloseOnExec $ fromIntegral $ fdSocket socket+setSocketCloseOnExec socket = do+#if MIN_VERSION_network(3,0,0)+ fd <- fdSocket socket+#else+ let fd = fdSocket socket+#endif+ F.setFileCloseOnExec $ fromIntegral fd #endif gracefulShutdown :: Settings -> Counter -> IO ()
warp.cabal view
@@ -1,5 +1,5 @@ Name: warp-Version: 3.2.25+Version: 3.2.26 Synopsis: A fast, light-weight web server for WAI applications. License: MIT License-file: LICENSE