diff --git a/http-client-tls/Network/HTTP/Client/TLS.hs b/http-client-tls/Network/HTTP/Client/TLS.hs index 5d977ec2..48bb6b74 100644 --- a/http-client-tls/Network/HTTP/Client/TLS.hs +++ b/http-client-tls/Network/HTTP/Client/TLS.hs @@ -40,7 +40,7 @@ import Data.ByteArray.Encoding (convertToBase, Base (Base16)) mkManagerSettings :: NC.TLSSettings -> Maybe NC.SockSettings -> ManagerSettings -mkManagerSettings = mkManagerSettingsContext Nothing +mkManagerSettings = mkManagerSettingsContext (Just globalContext) -- | Same as 'mkManagerSettings', but also takes an optional -- 'NC.ConnectionContext'. Providing this externally can be an @@ -83,7 +83,11 @@ mkManagerSettingsContext mcontext tls sock = defaultManagerSettings -- | Default TLS-enabled manager settings tlsManagerSettings :: ManagerSettings -tlsManagerSettings = mkManagerSettings def Nothing +tlsManagerSettings = mkManagerSettingsContext (Just globalContext) def Nothing + +globalContext :: NC.ConnectionContext +globalContext = unsafePerformIO NC.initConnectionContext +{-# NOINLINE globalContext #-} getTlsConnection :: Maybe NC.ConnectionContext -> Maybe NC.TLSSettings