diff --git a/cabal.project b/cabal.project index 08e1865b3..87f3e4cf8 100644 --- a/cabal.project +++ b/cabal.project @@ -19,7 +19,7 @@ source-repository-package source-repository-package type: git location: https://github.com/kazu-yamamoto/http2.git - tag: 804fa283f067bd3fd89b8c5f8d25b3047813a517 + tag: f5525b755ff2418e6e6ecc69e877363b0d0bcaeb source-repository-package type: git diff --git a/package.yaml b/package.yaml index 8fe00fbfa..f76d56313 100644 --- a/package.yaml +++ b/package.yaml @@ -45,7 +45,7 @@ dependencies: - filepath == 1.4.* - hourglass == 0.2.* - http-types == 0.12.* - - http2 >= 4.1.4 && < 4.2 + - http2 >= 4.2.2 && < 4.3 - ini == 0.4.1 - iproute == 1.7.* - iso8601-time == 0.1.* diff --git a/simplexmq.cabal b/simplexmq.cabal index 9f8937e5b..c88353845 100644 --- a/simplexmq.cabal +++ b/simplexmq.cabal @@ -185,7 +185,7 @@ library , filepath ==1.4.* , hourglass ==0.2.* , http-types ==0.12.* - , http2 >=4.1.4 && <4.2 + , http2 >=4.2.2 && <4.3 , ini ==0.4.1 , iproute ==1.7.* , iso8601-time ==0.1.* @@ -249,7 +249,7 @@ executable ntf-server , filepath ==1.4.* , hourglass ==0.2.* , http-types ==0.12.* - , http2 >=4.1.4 && <4.2 + , http2 >=4.2.2 && <4.3 , ini ==0.4.1 , iproute ==1.7.* , iso8601-time ==0.1.* @@ -314,7 +314,7 @@ executable smp-agent , filepath ==1.4.* , hourglass ==0.2.* , http-types ==0.12.* - , http2 >=4.1.4 && <4.2 + , http2 >=4.2.2 && <4.3 , ini ==0.4.1 , iproute ==1.7.* , iso8601-time ==0.1.* @@ -379,7 +379,7 @@ executable smp-server , filepath ==1.4.* , hourglass ==0.2.* , http-types ==0.12.* - , http2 >=4.1.4 && <4.2 + , http2 >=4.2.2 && <4.3 , ini ==0.4.1 , iproute ==1.7.* , iso8601-time ==0.1.* @@ -444,7 +444,7 @@ executable xftp , filepath ==1.4.* , hourglass ==0.2.* , http-types ==0.12.* - , http2 >=4.1.4 && <4.2 + , http2 >=4.2.2 && <4.3 , ini ==0.4.1 , iproute ==1.7.* , iso8601-time ==0.1.* @@ -509,7 +509,7 @@ executable xftp-server , filepath ==1.4.* , hourglass ==0.2.* , http-types ==0.12.* - , http2 >=4.1.4 && <4.2 + , http2 >=4.2.2 && <4.3 , ini ==0.4.1 , iproute ==1.7.* , iso8601-time ==0.1.* @@ -608,7 +608,7 @@ test-suite simplexmq-test , hspec ==2.11.* , hspec-core ==2.11.* , http-types ==0.12.* - , http2 >=4.1.4 && <4.2 + , http2 >=4.2.2 && <4.3 , ini ==0.4.1 , iproute ==1.7.* , iso8601-time ==0.1.* diff --git a/src/Simplex/Messaging/Transport/HTTP2.hs b/src/Simplex/Messaging/Transport/HTTP2.hs index 1feccce88..511f5d322 100644 --- a/src/Simplex/Messaging/Transport/HTTP2.hs +++ b/src/Simplex/Messaging/Transport/HTTP2.hs @@ -13,6 +13,7 @@ import Network.HPACK (BufferSize) import Network.HTTP2.Client (Config (..), defaultPositionReadMaker, freeSimpleConfig) import qualified Network.HTTP2.Client as HC import qualified Network.HTTP2.Server as HS +import Network.Socket (SockAddr (..)) import qualified Network.TLS as T import qualified Network.TLS.Extra as TE import Simplex.Messaging.Transport (SessionId, TLS (tlsUniq), Transport (cGet, cPut)) @@ -36,7 +37,9 @@ allocHTTP2Config c sz = do confSendAll = cPut c, confReadN = cGet c, confPositionReadMaker = defaultPositionReadMaker, - confTimeoutManager = tm + confTimeoutManager = tm, + confMySockAddr = SockAddrInet 0 0, + confPeerSockAddr = SockAddrInet 0 0 } http2TLSParams :: T.Supported diff --git a/src/Simplex/Messaging/Transport/HTTP2/Client.hs b/src/Simplex/Messaging/Transport/HTTP2/Client.hs index 449a9bc59..595ab411e 100644 --- a/src/Simplex/Messaging/Transport/HTTP2/Client.hs +++ b/src/Simplex/Messaging/Transport/HTTP2/Client.hs @@ -2,6 +2,7 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} module Simplex.Messaging.Transport.HTTP2.Client where @@ -162,4 +163,4 @@ runHTTP2ClientWith :: forall a. BufferSize -> TransportHost -> ((TLS -> IO a) -> runHTTP2ClientWith bufferSize host setup client = setup $ withHTTP2 bufferSize run where run :: H.Config -> SessionId -> IO a - run cfg = H.run (ClientConfig "https" (strEncode host) 20) cfg . client + run cfg sessId = H.run (ClientConfig "https" (strEncode host) 20) cfg $ client sessId diff --git a/stack.yaml b/stack.yaml index 4ba98eedb..338748ecd 100644 --- a/stack.yaml +++ b/stack.yaml @@ -49,7 +49,7 @@ extra-deps: - github: simplex-chat/aeson commit: aab7b5a14d6c5ea64c64dcaee418de1bb00dcc2b - github: kazu-yamamoto/http2 - commit: 804fa283f067bd3fd89b8c5f8d25b3047813a517 + commit: f5525b755ff2418e6e6ecc69e877363b0d0bcaeb # - ../direct-sqlcipher - github: simplex-chat/direct-sqlcipher commit: f814ee68b16a9447fbb467ccc8f29bdd3546bfd9