warp 1.2.1 → 1.2.1.1
raw patch · 2 files changed
+15/−6 lines, 2 files
Files
- Network/Wai/Handler/Warp.hs +14/−5
- warp.cabal +1/−1
Network/Wai/Handler/Warp.hs view
@@ -32,6 +32,8 @@ , settingsPort , settingsHost , settingsOnException+ , settingsOnOpen+ , settingsOnClose , settingsTimeout , settingsIntercept , settingsManager@@ -76,7 +78,7 @@ , Exception, SomeException , fromException, AsyncException (ThreadKilled) , try-#if GLASGOW_HASKELL >= 721+#if __GLASGOW_HASKELL__ >= 702 , allowInterrupt #else , unblock@@ -134,7 +136,7 @@ warpVersion :: String warpVersion = showVersion Paths_warp.version -#if GLASGOW_HASKELL < 721+#if __GLASGOW_HASKELL__ < 702 allowInterrupt :: IO () allowInterrupt = unblock $ return () #endif@@ -219,6 +221,8 @@ runSettingsConnection set getConn app = do let onE = settingsOnException set port = settingsPort set+ onOpen = settingsOnOpen set+ onClose = settingsOnClose set tm <- maybe (T.initialize $ settingsTimeout set * 1000000) return $ settingsManager set mask $ \restore -> forever $ do@@ -226,9 +230,10 @@ (conn, addr) <- getConn void $ forkIO $ do th <- T.registerKillThread tm- handle onE $ (do restore $ serveConnection set th port app conn addr- connClose conn >> T.cancel th- ) `onException` (T.cancel th >> connClose conn)+ handle onE $ (do onOpen+ restore $ serveConnection set th port app conn addr+ connClose conn >> T.cancel th >> onClose+ ) `onException` (T.cancel th >> connClose conn >> onClose) -- | Contains a @Source@ and a byte count that is still to be read in. newtype IsolatedBSSource = IsolatedBSSource (I.IORef (Int, C.Source (ResourceT IO) ByteString))@@ -694,6 +699,8 @@ { settingsPort :: Int -- ^ Port to listen on. Default value: 3000 , settingsHost :: HostPreference -- ^ Default value: HostIPv4 , settingsOnException :: SomeException -> IO () -- ^ 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.+ , settingsOnOpen :: IO () -- ^ What to do when a connection is open. Default: do nothing.+ , settingsOnClose :: IO () -- ^ What to do when a connection is close. Default: do nothing. , settingsTimeout :: Int -- ^ Timeout value in seconds. Default value: 30 , settingsIntercept :: Request -> Maybe (C.Source (ResourceT IO) S.ByteString -> Connection -> ResourceT IO ()) , settingsManager :: Maybe Manager -- ^ Use an existing timeout manager instead of spawning a new one. If used, 'settingsTimeout' is ignored. Default is 'Nothing'@@ -711,6 +718,8 @@ Nothing -> when (go' $ fromException e) $ hPrint stderr e+ , settingsOnOpen = return ()+ , settingsOnClose = return () , settingsTimeout = 30 , settingsIntercept = const Nothing , settingsManager = Nothing
warp.cabal view
@@ -1,5 +1,5 @@ Name: warp-Version: 1.2.1+Version: 1.2.1.1 Synopsis: A fast, light-weight web server for WAI applications. License: MIT License-file: LICENSE