warp 3.0.3 → 3.0.4
raw patch · 6 files changed
+37/−7 lines, 6 files
Files
- ChangeLog.md +4/−0
- Network/Wai/Handler/Warp.hs +13/−0
- Network/Wai/Handler/Warp/Run.hs +2/−2
- Network/Wai/Handler/Warp/Settings.hs +16/−2
- Network/Wai/Handler/Warp/Windows.hs +1/−2
- warp.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,7 @@+## 3.0.4++Added `setFork`.+ ## 3.0.3 Modify flushing of request bodies. Previously, regardless of the size of the
Network/Wai/Handler/Warp.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE RankNTypes #-} {-# OPTIONS_GHC -fno-warn-deprecations #-} ---------------------------------------------------------@@ -42,6 +43,7 @@ , setInstallShutdownHandler , setServerName , setMaximumBodyFlush+ , setFork -- ** Getters , getPort , getHost@@ -228,3 +230,14 @@ setMaximumBodyFlush x y | Just x' <- x, x' < 0 = error "setMaximumBodyFlush: must be positive" | otherwise = y { settingsMaximumBodyFlush = x }++-- | 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+setFork :: (((forall a. IO a -> IO a) -> IO ()) -> IO ()) -> Settings -> Settings+setFork fork' s = s { settingsFork = fork' }
Network/Wai/Handler/Warp/Run.hs view
@@ -7,7 +7,7 @@ module Network.Wai.Handler.Warp.Run where import Control.Arrow (first)-import Control.Concurrent (threadDelay, forkIOWithUnmask)+import Control.Concurrent (threadDelay) import qualified Control.Concurrent as Conc (yield) import Control.Exception as E import Control.Monad (when, unless, void)@@ -225,7 +225,7 @@ -> T.Manager -> Counter -> IO ()-fork set mkConn addr app dc fc tm counter = void $ forkIOWithUnmask $ \unmask ->+fork set mkConn addr app dc fc tm counter = settingsFork set $ \ unmask -> -- Run the connection maker to get a new connection, and ensure -- that the connection is closed. If the mkConn call throws an -- exception, we will leak the connection. If the mkConn call is
Network/Wai/Handler/Warp/Settings.hs view
@@ -1,10 +1,12 @@ {-# LANGUAGE OverloadedStrings, ScopedTypeVariables, ViewPatterns #-}-{-# LANGUAGE PatternGuards #-}+{-# LANGUAGE PatternGuards, RankNTypes #-}+{-# LANGUAGE ImpredicativeTypes #-} module Network.Wai.Handler.Warp.Settings where import Control.Exception-import Control.Monad (when)+import Control.Monad (when, void)+import Control.Concurrent (forkIOWithUnmask) import qualified Data.Text as T import qualified Data.Text.IO as TIO import Data.Streaming.Network (HostPreference)@@ -52,6 +54,17 @@ -- 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 -- ^ Perform no parsing on the rawPathInfo. --@@ -85,6 +98,7 @@ , settingsManager = Nothing , settingsFdCacheDuration = 10 , settingsBeforeMainLoop = return ()+ , settingsFork = void . forkIOWithUnmask , settingsNoParsePath = False , settingsInstallShutdownHandler = const $ return () , settingsServerName = S8.pack $ "Warp/" ++ showVersion Paths_warp.version
Network/Wai/Handler/Warp/Windows.hs view
@@ -10,8 +10,7 @@ import Control.Monad windowsThreadBlockHack :: IO a -> IO a-windowsThreadBlockHack act = - do+windowsThreadBlockHack act = do var <- newEmptyMVar :: IO (MVar (Either SomeException a)) void . forkIO $ try act >>= putMVar var res <- takeMVar var
warp.cabal view
@@ -1,5 +1,5 @@ Name: warp-Version: 3.0.3+Version: 3.0.4 Synopsis: A fast, light-weight web server for WAI applications. License: MIT License-file: LICENSE