Skip to content

Commit 944bb8e

Browse files
committed
Share the global connection manager with the rest of the program
1 parent 4032bf0 commit 944bb8e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/Stackage/Package/HttpLib.hs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Data.List (intercalate)
2121
import Network.HTTP.Client
2222
(Manager, Request(..), Response(..), requestFromURI)
2323
import qualified Network.HTTP.Client as HTTP
24-
import Network.HTTP.Client.TLS (newTlsManager)
24+
import Network.HTTP.Client.TLS (getGlobalManager)
2525
import Network.HTTP.Types (statusCode)
2626
import Network.URI (URI)
2727

@@ -30,10 +30,11 @@ import Hackage.Security.Client.Repository.HttpLib
3030
import Hackage.Security.Util.Checked
3131
import Hackage.Security.Util.Pretty (Pretty(..))
3232

33-
-- | Run an action with an 'HttpLib' backed by a shared TLS-capable manager.
33+
-- | Run an action with an 'HttpLib' backed by the same connection pool that
34+
-- @Network.HTTP.Simple@ uses elsewhere in this program.
3435
withHttpLib :: (HttpLib -> IO a) -> IO a
3536
withHttpLib callback = do
36-
manager <- newTlsManager
37+
manager <- getGlobalManager
3738
callback
3839
HttpLib
3940
{ httpGet = get manager

0 commit comments

Comments
 (0)