Skip to content

Commit

Permalink
allow newer crypton-connection
Browse files Browse the repository at this point in the history
Change-Id: I13c6bebcb51ba0dcfdbc73b9160a490e8a1fae8f
  • Loading branch information
chessai committed May 20, 2024
1 parent 647b2f5 commit 8d2e8ac
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/Chainweb/Utils.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
Expand Down Expand Up @@ -245,6 +246,10 @@ import qualified Data.ByteString.Builder as BB
import qualified Data.ByteString.Lazy as BL
import qualified Data.Csv as CSV
import Data.Decimal
#if MIN_VERSION_crypton_connection(0,4,0)
import Data.Default (def)
import qualified Network.TLS.Extra.Cipher as HTTP
#endif
import Data.Functor.Of
import Data.Hashable
import qualified Data.HashMap.Strict as HM
Expand Down Expand Up @@ -1334,18 +1339,28 @@ manager micros = HTTP.newManager
unsafeManager :: Int -> IO HTTP.Manager
unsafeManager micros = HTTP.newTlsManagerWith
$ setManagerRequestTimeout micros
$ HTTP.mkManagerSettings (HTTP.TLSSettingsSimple True True True) Nothing
$ HTTP.mkManagerSettings unsafeSimpleTLSSettings Nothing

unsafeManagerWithSettings :: (HTTP.ManagerSettings -> HTTP.ManagerSettings) -> IO HTTP.Manager
unsafeManagerWithSettings settings = HTTP.newTlsManagerWith
$ settings
$ HTTP.mkManagerSettings (HTTP.TLSSettingsSimple True True True) Nothing
$ HTTP.mkManagerSettings unsafeSimpleTLSSettings Nothing

setManagerRequestTimeout :: Int -> HTTP.ManagerSettings -> HTTP.ManagerSettings
setManagerRequestTimeout micros settings = settings
{ HTTP.managerResponseTimeout = HTTP.responseTimeoutMicro micros
}

unsafeSimpleTLSSettings :: HTTP.TLSSettings
unsafeSimpleTLSSettings = HTTP.TLSSettingsSimple
{ HTTP.settingDisableCertificateValidation = True
, HTTP.settingDisableSession = True
, HTTP.settingUseServerName = True
#if MIN_VERSION_crypton_connection(0,4,0)
, HTTP.settingClientSupported = def { HTTP.supportedCiphers = HTTP.ciphersuite_default }

Check failure on line 1360 in src/Chainweb/Utils.hs

View workflow job for this annotation

GitHub Actions / Build (9.6.4, 3.10, macos-14-large, true)

Not in scope: ‘HTTP.supportedCiphers’

Check failure on line 1360 in src/Chainweb/Utils.hs

View workflow job for this annotation

GitHub Actions / Build (9.6.4, 3.10, ubuntu-20.04, false)

Not in scope: ‘HTTP.supportedCiphers’

Check failure on line 1360 in src/Chainweb/Utils.hs

View workflow job for this annotation

GitHub Actions / Build (9.6.4, 3.10, ubuntu-22.04, false)

Not in scope: ‘HTTP.supportedCiphers’

Check failure on line 1360 in src/Chainweb/Utils.hs

View workflow job for this annotation

GitHub Actions / Build (9.8.1, 3.10, ubuntu-20.04, false)

Not in scope: record field ‘HTTP.supportedCiphers’

Check failure on line 1360 in src/Chainweb/Utils.hs

View workflow job for this annotation

GitHub Actions / Build (9.8.1, 3.10, ubuntu-22.04, false)

Not in scope: record field ‘HTTP.supportedCiphers’
#endif
}

-- -------------------------------------------------------------------------- --
-- SockAddr from network package

Expand Down

0 comments on commit 8d2e8ac

Please sign in to comment.