From e9b5a849ab18de085e8c69d239a9706b99bcf787 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Wed, 1 Nov 2023 10:57:19 +0000 Subject: [PATCH] update http2 to 4.2.2 (#879) --- cabal.project | 2 +- package.yaml | 2 +- simplexmq.cabal | 14 +++++++------- src/Simplex/Messaging/Transport/HTTP2.hs | 5 ++++- src/Simplex/Messaging/Transport/HTTP2/Client.hs | 3 ++- stack.yaml | 2 +- 6 files changed, 16 insertions(+), 12 deletions(-) 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 3b00c8552..37bf3b13e 100644 --- a/package.yaml +++ b/package.yaml @@ -43,7 +43,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 7ad59b427..b89307227 100644 --- a/simplexmq.cabal +++ b/simplexmq.cabal @@ -168,7 +168,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.* @@ -231,7 +231,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.* @@ -295,7 +295,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.* @@ -359,7 +359,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.* @@ -423,7 +423,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.* @@ -487,7 +487,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.* @@ -585,7 +585,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