warp 3.2.15 → 3.2.16
raw patch · 3 files changed
+14/−14 lines, 3 files
Files
- ChangeLog.md +6/−0
- Network/Wai/Handler/Warp/WithApplication.hs +7/−13
- warp.cabal +1/−1
ChangeLog.md view
@@ -1,3 +1,9 @@+## 3.2.16++* In `testWithApplication`, don't `throwTo` ignorable exceptions+ [#671](https://github.com/yesodweb/wai/issues/671), and+ reuse `bindRandomPortTCP`+ ## 3.2.15 * Address space leak from exception handlers
Network/Wai/Handler/Warp/WithApplication.hs view
@@ -1,4 +1,4 @@-+{-# LANGUAGE OverloadedStrings #-} module Network.Wai.Handler.Warp.WithApplication ( withApplication, withApplicationSettings,@@ -11,6 +11,8 @@ import Control.Concurrent import Control.Concurrent.Async import Control.Exception+import Control.Monad (when)+import Data.Streaming.Network (bindRandomPortTCP) import Network.Socket import Network.Wai import Network.Wai.Handler.Warp.Run@@ -71,7 +73,9 @@ app <- mkApp let wrappedApp request respond = app request respond `catch` \ e -> do- throwTo callingThread (e :: SomeException)+ when+ (defaultShouldDisplayException e)+ (throwTo callingThread e) throwIO e withApplication (return wrappedApp) action @@ -93,17 +97,7 @@ -- -- @since 3.2.4 openFreePort :: IO (Port, Socket)-openFreePort = do- let hints = defaultHints {- addrFlags = [AI_PASSIVE]- , addrSocketType = Stream- }- addr:_ <- getAddrInfo (Just hints) (Just "127.0.0.1") Nothing- s <- socket (addrFamily addr) (addrSocketType addr) (addrProtocol addr)- bind s $ addrAddress addr- listen s 1- port <- socketPort s- return (fromIntegral port, s)+openFreePort = bindRandomPortTCP "127.0.0.1" -- | Like 'openFreePort' but closes the socket before exiting. withFreePort :: ((Port, Socket) -> IO a) -> IO a
warp.cabal view
@@ -1,5 +1,5 @@ Name: warp-Version: 3.2.15+Version: 3.2.16 Synopsis: A fast, light-weight web server for WAI applications. License: MIT License-file: LICENSE