Skip to content

Commit 046e694

Browse files
akshaymankarfisx
andauthored
Introduce Http2Manager to help with reusing http2 connections (#3120)
Co-authored-by: fisx <[email protected]>
1 parent 5f5dac3 commit 046e694

File tree

39 files changed

+1899
-28
lines changed

39 files changed

+1899
-28
lines changed

cabal.project

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ packages:
1111
, libs/galley-types/
1212
, libs/gundeck-types/
1313
, libs/hscim/
14+
, libs/http2-manager/
1415
, libs/imports/
1516
, libs/jwt-tools/
1617
, libs/metrics-core/
@@ -100,6 +101,8 @@ package gundeck-types
100101
ghc-options: -Werror
101102
package hscim
102103
ghc-options: -Werror
104+
package http2-manager
105+
ghc-options: -Werror
103106
package imports
104107
ghc-options: -Werror
105108
package jwt-tools

changelog.d/5-internal/reuse-http2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Reuse HTTP2 connections from brig, galley, cargohold and federator

libs/http2-manager/LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

libs/http2-manager/default.nix

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# WARNING: GENERATED FILE, DO NOT EDIT.
2+
# This file is generated by running hack/bin/generate-local-nix-packages.sh and
3+
# must be regenerated whenever local packages are added or removed, or
4+
# dependencies are added or removed.
5+
{ mkDerivation
6+
, async
7+
, base
8+
, bytestring
9+
, containers
10+
, gitignoreSource
11+
, HsOpenSSL
12+
, hspec
13+
, hspec-discover
14+
, http-types
15+
, http2
16+
, lib
17+
, network
18+
, random
19+
, stm
20+
, streaming-commons
21+
, text
22+
, time-manager
23+
}:
24+
mkDerivation {
25+
pname = "http2-manager";
26+
version = "0.0.1";
27+
src = gitignoreSource ./.;
28+
libraryHaskellDepends = [
29+
async
30+
base
31+
bytestring
32+
containers
33+
HsOpenSSL
34+
http2
35+
network
36+
stm
37+
streaming-commons
38+
text
39+
time-manager
40+
];
41+
testHaskellDepends = [
42+
async
43+
base
44+
bytestring
45+
containers
46+
HsOpenSSL
47+
hspec
48+
http-types
49+
http2
50+
network
51+
random
52+
stm
53+
streaming-commons
54+
time-manager
55+
];
56+
testToolDepends = [ hspec-discover ];
57+
description = "Managed connection pool for HTTP2";
58+
license = lib.licenses.agpl3Only;
59+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
cabal-version: 1.12
2+
name: http2-manager
3+
version: 0.0.1
4+
synopsis: Managed connection pool for HTTP2
5+
description: Helps reuse HTTP2 connections with TLS support
6+
category: Web
7+
author: Wire Swiss GmbH
8+
maintainer: Wire Swiss GmbH <[email protected]>
9+
copyright: (c) 2020 Wire Swiss GmbH
10+
license: AGPL-3
11+
license-file: LICENSE
12+
build-type: Simple
13+
14+
-- cabal-fmt: glob-files test/resources/*.pem
15+
extra-source-files:
16+
test/resources/localhost-key.pem
17+
test/resources/localhost.example.com-key.pem
18+
test/resources/localhost.example.com.pem
19+
test/resources/localhost.pem
20+
test/resources/unit-ca-key.pem
21+
test/resources/unit-ca.pem
22+
23+
library
24+
-- cabal-fmt: expand src
25+
exposed-modules:
26+
HTTP2.Client.Manager
27+
HTTP2.Client.Manager.Internal
28+
29+
other-modules: Paths_http2_manager
30+
hs-source-dirs: src
31+
ghc-options:
32+
-O2 -Wall -Wincomplete-uni-patterns -Wincomplete-record-updates
33+
-Wpartial-fields -fwarn-tabs -Wredundant-constraints
34+
35+
build-depends:
36+
async
37+
, base
38+
, bytestring
39+
, containers
40+
, HsOpenSSL
41+
, http2
42+
, network
43+
, stm
44+
, streaming-commons
45+
, text
46+
, time-manager
47+
48+
default-language: Haskell2010
49+
50+
test-suite http2-manager-tests
51+
type: exitcode-stdio-1.0
52+
main-is: Main.hs
53+
ghc-options:
54+
-Wall -Wincomplete-uni-patterns -Wincomplete-record-updates
55+
-Wpartial-fields -fwarn-tabs -optP-Wno-nonportable-include-path
56+
-Wredundant-constraints -threaded -with-rtsopts=-N
57+
58+
-- cabal-fmt: expand test
59+
other-modules:
60+
Main
61+
Test.HTTP2.Client.ManagerSpec
62+
63+
hs-source-dirs: test
64+
build-tool-depends: hspec-discover:hspec-discover
65+
build-depends:
66+
async
67+
, base
68+
, bytestring
69+
, containers
70+
, HsOpenSSL
71+
, hspec
72+
, http-types
73+
, http2
74+
, http2-manager
75+
, network
76+
, random
77+
, stm
78+
, streaming-commons
79+
, time-manager
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module HTTP2.Client.Manager
2+
( Http2Manager,
3+
setCacheLimit,
4+
setSSLContext,
5+
TLSEnabled,
6+
HostName,
7+
Port,
8+
Target,
9+
defaultHttp2Manager,
10+
http2ManagerWithSSLCtx,
11+
withHTTP2Request,
12+
connectIfNotAlreadyConnected,
13+
ConnectionAlreadyClosed (..),
14+
disconnectTarget,
15+
disconnectTargetWithTimeout,
16+
)
17+
where
18+
19+
import HTTP2.Client.Manager.Internal

0 commit comments

Comments
 (0)