Skip to content

Commit

Permalink
Use latest http2 (5.0) and http2-tls (0.2)
Browse files Browse the repository at this point in the history
Also update `Tested-With` and re-run `haskell-ci`.
  • Loading branch information
edsko committed Nov 29, 2023
1 parent 0148d3d commit 5fdab41
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 47 deletions.
21 changes: 8 additions & 13 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.17.20230925
# version: 0.17.20231110
#
# REGENDATA ("0.17.20230925",["github","cabal.project.ci"])
# REGENDATA ("0.17.20231110",["github","cabal.project.ci"])
#
name: Haskell-CI
on:
Expand All @@ -28,14 +28,14 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.6.2
- compiler: ghc-9.6.3
compilerKind: ghc
compilerVersion: 9.6.2
compilerVersion: 9.6.3
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.5
- compiler: ghc-9.4.8
compilerKind: ghc
compilerVersion: 9.4.5
compilerVersion: 9.4.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.8
Expand All @@ -58,7 +58,7 @@ jobs:
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.2.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
Expand All @@ -76,7 +76,7 @@ jobs:
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
Expand Down Expand Up @@ -160,11 +160,6 @@ jobs:
echo "package grapesy" >> cabal.project
echo " ghc-options: -Werror=missing-methods" >> cabal.project
cat >> cabal.project <<EOF
source-repository-package
type: git
location: https://github.com/edsko/http2.git
tag: c2a2994ed45a08998c2b6eb22a08f28b9eb36c3c
package grapesy
tests: True
flags: +build-demo +build-stress-test
Expand Down
7 changes: 0 additions & 7 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,3 @@ packages: .
package grapesy
tests: True
flags: +build-demo +build-stress-test

-- The version on Hackage also works, it just writes some (unnecessary)
-- exceptions to stderr
source-repository-package
type: git
location: https://github.com/edsko/http2.git
tag: c2a2994ed45a08998c2b6eb22a08f28b9eb36c3c
5 changes: 0 additions & 5 deletions cabal.project.ci
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,3 @@ package grapesy
tests: True
flags: +build-demo +build-stress-test
ghc-options: -Werror

source-repository-package
type: git
location: https://github.com/edsko/http2.git
tag: c2a2994ed45a08998c2b6eb22a08f28b9eb36c3c
20 changes: 9 additions & 11 deletions grapesy.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ data-files: route_guide_db.json
grpc-demo.priv
tested-with: GHC==8.10.7
, GHC==9.2.8
, GHC==9.4.5
, GHC==9.6.2
, GHC==9.4.8
, GHC==9.6.3

common lang
ghc-options:
Expand Down Expand Up @@ -150,6 +150,8 @@ library
, generics-sop >= 0.5 && < 0.6
, hashable >= 1.3 && < 1.5
, http-types >= 0.12 && < 0.13
, http2 >= 5.0 && < 5.1
, http2-tls >= 0.2 && < 0.3
, mtl >= 2.2 && < 2.4
, network >= 3.1 && < 3.2
, network-byte-order >= 0.1 && < 0.2
Expand All @@ -167,16 +169,12 @@ library
, utf8-string >= 1.0 && < 1.1
, zlib >= 0.6 && < 0.7

-- We need an unreleased version of http2 right now
, http2
, http2-tls

-- tls 1.7 starts using Kazu's forked versions of x509-* packages
if flag(crypton)
-- Lower bounds are the first version of these packages after forking.
-- Upper bounds as discussed above.
build-depends:
, tls >= 1.7 && < 1.8
, tls >= 1.7 && < 1.10
, crypton-x509 >= 1.7 && < 1.8
, crypton-x509-store >= 1.6 && < 1.7
, crypton-x509-system >= 1.6 && < 1.7
Expand Down Expand Up @@ -227,7 +225,7 @@ test-suite test-grapesy
, contra-tracer >= 0.2 && < 0.3
, data-default >= 0.7 && < 0.8
, exceptions >= 0.10 && < 0.11
, http2
, http2 >= 5.0 && < 5.1
, mtl >= 2.2 && < 2.4
, pretty-show >= 1.10 && < 1.11
, QuickCheck >= 2.14 && < 2.15
Expand All @@ -236,7 +234,7 @@ test-suite test-grapesy
, tasty-hunit >= 0.10 && < 0.11
, tasty-quickcheck >= 0.10 && < 0.11
, text >= 1.2 && < 2.1
, tls >= 1.5 && < 1.8
, tls >= 1.5 && < 1.10

executable demo-client
import:
Expand Down Expand Up @@ -353,12 +351,12 @@ executable test-stress
, containers >= 0.6 && < 0.7
, contra-tracer >= 0.2 && < 0.3
, data-default >= 0.7 && < 0.8
, http2
, http2 >= 5.0 && < 5.1
, optparse-applicative >= 0.16 && < 0.19
, pretty-show >= 1.10 && < 1.11
, stm >= 2.5 && < 2.6
, text >= 1.2 && < 2.1
, tls >= 1.5 && < 1.8
, tls >= 1.5 && < 1.10

if !flag(build-stress-test)
buildable:
Expand Down
15 changes: 5 additions & 10 deletions src/Network/GRPC/Client/Connection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ stayConnected connParams server connVar connCanClose =
HTTP2.Client.run
(clientConfig auth Http)
conf
$ \sendRequest -> do
$ \sendRequest _aux -> do
traceWith tracer $ ClientDebugConnectedInsecure
let conn = Session.ConnectionToServer sendRequest
atomically $ writeTVar connVar $ ConnectionReady connClosed conn
Expand All @@ -423,7 +423,7 @@ stayConnected connParams server connVar connCanClose =
settings
(authorityHost auth)
(fromIntegral $ authorityPort auth)
$ \sendRequest -> do
$ \sendRequest _aux -> do
traceWith tracer $ ClientDebugConnectedSecure
let conn = Session.ConnectionToServer sendRequest
atomically $ writeTVar connVar $ ConnectionReady connClosed conn
Expand Down Expand Up @@ -470,14 +470,9 @@ stayConnected connParams server connVar connCanClose =

-- TODO: This is currently only used for the HTTP case, not HTTPS
clientConfig :: Authority -> Scheme -> HTTP2.Client.ClientConfig
clientConfig auth scheme = HTTP2.Client.ClientConfig {
scheme = rawScheme serverPseudoHeaders
, authority = rawAuthority serverPseudoHeaders

-- Docs describe this as "How many pushed responses are contained in
-- the cache". Since gRPC does not make use of HTTP2 server push, we
-- set it to 0.
, cacheLimit = 0
clientConfig auth scheme = HTTP2.Client.defaultClientConfig {
HTTP2.Client.scheme = rawScheme serverPseudoHeaders
, HTTP2.Client.authority = rawAuthority serverPseudoHeaders
}
where
serverPseudoHeaders :: RawServerHeaders
Expand Down
2 changes: 1 addition & 1 deletion src/Network/GRPC/Server/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ runInsecure ServerSetup{serverHandlerHook} server cfg =
runTCPServer (insecureHost cfg) (insecurePort cfg) $ \sock -> do
bracket (HTTP2.allocSimpleConfig sock writeBufferSize)
HTTP2.freeSimpleConfig $ \config ->
HTTP2.run config $ serverHandlerHook server
HTTP2.run HTTP2.defaultServerConfig config $ serverHandlerHook server

{-------------------------------------------------------------------------------
Secure (over TLS)
Expand Down
12 changes: 12 additions & 0 deletions test-common/Test/Util/ClientServer.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}

module Test.Util.ClientServer (
Expand Down Expand Up @@ -175,6 +176,16 @@ isExpectedException cfg assessCustomException topLevel =

| Just (tls :: TLSException) <- fromException err
= case (useTLS cfg, tls) of
#if MIN_VERSION_tls(1,9,0)
( Just (TlsFail TlsFailValidation)
, HandshakeFailed (Error_Protocol _msg UnknownCa)
) ->
Right $ ExpectedExceptionTls tls
( Just (TlsFail TlsFailHostname)
, HandshakeFailed (Error_Protocol _msg CertificateUnknown)
) ->
Right $ ExpectedExceptionTls tls
#else
( Just (TlsFail TlsFailValidation)
, HandshakeFailed (Error_Protocol (_msg, _bool, UnknownCa))
) ->
Expand All @@ -183,6 +194,7 @@ isExpectedException cfg assessCustomException topLevel =
, HandshakeFailed (Error_Protocol (_msg, _bool, CertificateUnknown))
) ->
Right $ ExpectedExceptionTls tls
#endif
( Just (TlsFail TlsFailUnsupported)
, HandshakeFailed (Error_Packet_Parsing _)
) ->
Expand Down

0 comments on commit 5fdab41

Please sign in to comment.