Skip to content

Commit e96f049

Browse files
committed
Introduce global connection context #214
1 parent 5cf3bd0 commit e96f049

File tree

1 file changed

+5
-1
lines changed
  • http-client-tls/Network/HTTP/Client

1 file changed

+5
-1
lines changed

http-client-tls/Network/HTTP/Client/TLS.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ import Data.ByteArray.Encoding (convertToBase, Base (Base16))
4040
mkManagerSettings :: NC.TLSSettings
4141
-> Maybe NC.SockSettings
4242
-> ManagerSettings
43-
mkManagerSettings = mkManagerSettingsContext Nothing
43+
mkManagerSettings = mkManagerSettingsContext (Just globalContext)
4444

4545
-- | Same as 'mkManagerSettings', but also takes an optional
4646
-- 'NC.ConnectionContext'. Providing this externally can be an
@@ -85,6 +85,10 @@ mkManagerSettingsContext mcontext tls sock = defaultManagerSettings
8585
tlsManagerSettings :: ManagerSettings
8686
tlsManagerSettings = mkManagerSettings def Nothing
8787

88+
globalContext :: NC.ConnectionContext
89+
globalContext = unsafePerformIO NC.initConnectionContext
90+
{-# NOINLINE globalContext #-}
91+
8892
getTlsConnection :: Maybe NC.ConnectionContext
8993
-> Maybe NC.TLSSettings
9094
-> Maybe NC.SockSettings

0 commit comments

Comments
 (0)