http-client 0.2.0.3 → 0.2.1
raw patch · 3 files changed
+16/−2 lines, 3 files
Files
- Network/HTTP/Client.hs +7/−0
- Network/HTTP/Client/Manager.hs +8/−1
- http-client.cabal +1/−1
Network/HTTP/Client.hs view
@@ -17,6 +17,12 @@ -- 'newManager' 'defaultManagerSettings' -- @ --+-- or using the 'braket' pattern with+--+-- @+-- 'withManager' 'defaultManagerSettings'+-- @+-- -- The next core component is a @Request@, which represents a single HTTP -- request to be sent to a specific server. @Request@s allow for many settings -- to control exact how they function, but usually the simplest approach for@@ -56,6 +62,7 @@ , Manager , newManager , closeManager+ , withManager -- ** Connection manager settings , ManagerSettings , defaultManagerSettings
Network/HTTP/Client/Manager.hs view
@@ -8,6 +8,7 @@ ( ManagerSettings (..) , newManager , closeManager+ , withManager , getConn , failedConnectionException , defaultManagerSettings@@ -31,7 +32,7 @@ import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad (unless)-import Control.Exception (mask_, SomeException, catch, throwIO, fromException, mask, IOException, Exception (..), handle)+import Control.Exception (mask_, SomeException, bracket, catch, throwIO, fromException, mask, IOException, Exception (..), handle) import Control.Concurrent (forkIO, threadDelay) import Data.Time (UTCTime (..), Day (..), DiffTime, getCurrentTime, addUTCTime) import Control.DeepSeq (deepseq)@@ -243,6 +244,12 @@ closeManager' connsRef = mask_ $ do m <- I.atomicModifyIORef connsRef $ \x -> (Nothing, x) mapM_ (nonEmptyMapM_ safeConnClose) $ maybe [] Map.elems m++-- | Create, use and close a 'Manager'.+--+-- Since 0.2.1+withManager :: ManagerSettings -> (Manager -> IO a) -> IO a+withManager settings = bracket (newManager settings) closeManager safeConnClose :: Connection -> IO () safeConnClose ci = connectionClose ci `catch` \(_ :: IOException) -> return ()
http-client.cabal view
@@ -1,5 +1,5 @@ name: http-client-version: 0.2.0.3+version: 0.2.1 synopsis: An HTTP client engine, intended as a base layer for more user-friendly packages. description: This codebase has been refactored from http-conduit. homepage: https://github.com/snoyberg/http-client