Skip to content

Commit 1848e64

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

File tree

1 file changed

+6
-2
lines changed
  • http-client-tls/Network/HTTP/Client

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
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
@@ -83,7 +83,11 @@ mkManagerSettingsContext mcontext tls sock = defaultManagerSettings
8383

8484
-- | Default TLS-enabled manager settings
8585
tlsManagerSettings :: ManagerSettings
86-
tlsManagerSettings = mkManagerSettings def Nothing
86+
tlsManagerSettings = mkManagerSettingsContext (Just globalContext) def Nothing
87+
88+
globalContext :: NC.ConnectionContext
89+
globalContext = unsafePerformIO NC.initConnectionContext
90+
{-# NOINLINE globalContext #-}
8791

8892
getTlsConnection :: Maybe NC.ConnectionContext
8993
-> Maybe NC.TLSSettings

0 commit comments

Comments
 (0)