From 54271192053bb90617753e46dcf220107c52fb41 Mon Sep 17 00:00:00 2001 From: Lorenz Brun Date: Sun, 31 Jan 2021 02:44:30 +0100 Subject: [PATCH 1/2] Allow HTTP/2 --- internal/backend/http_transport.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/backend/http_transport.go b/internal/backend/http_transport.go index 30d25ba78..1d6ee17c6 100644 --- a/internal/backend/http_transport.go +++ b/internal/backend/http_transport.go @@ -70,6 +70,7 @@ func Transport(opts TransportOptions) (http.RoundTripper, error) { KeepAlive: 30 * time.Second, DualStack: true, }).DialContext, + ForceAttemptHTTP2: true, MaxIdleConns: 100, MaxIdleConnsPerHost: 100, IdleConnTimeout: 90 * time.Second, From 362338dd60bd59902b2c18a7362e1cdc1d1e73f5 Mon Sep 17 00:00:00 2001 From: Lorenz Brun Date: Mon, 1 Feb 2021 20:20:34 +0100 Subject: [PATCH 2/2] Add changelog entry --- changelog/unreleased/pull-3254 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 changelog/unreleased/pull-3254 diff --git a/changelog/unreleased/pull-3254 b/changelog/unreleased/pull-3254 new file mode 100644 index 000000000..dfa94ba51 --- /dev/null +++ b/changelog/unreleased/pull-3254 @@ -0,0 +1,8 @@ +Enhancement: Enable HTTP/2 for backend connections + +Go's HTTP library usually automatically chooses between HTTP/1.x and HTTP/2 +depending on what the server supports. But for compatibility this mechanism +is disabled if DialContext is used (which is the case for restic). This change +allows restic's HTTP client to negotiate HTTP/2 if supported by the server. + +https://github.com/restic/restic/pull/3254