From 3130af377340bdbb2ebdf7017e49868ab60b8742 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 30 Aug 2023 21:58:34 +0200 Subject: [PATCH] lib/upgrade: Enable HTTP/2 for upgrade checks (#9060) --- lib/upgrade/upgrade_supported.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/upgrade/upgrade_supported.go b/lib/upgrade/upgrade_supported.go index 74b1ae899..b43654d7e 100644 --- a/lib/upgrade/upgrade_supported.go +++ b/lib/upgrade/upgrade_supported.go @@ -30,6 +30,7 @@ import ( "github.com/syncthing/syncthing/lib/dialer" "github.com/syncthing/syncthing/lib/signature" + "golang.org/x/net/http2" ) const DisabledByCompilation = false @@ -75,8 +76,12 @@ var insecureHTTP = &http.Client{ }, } +func init() { + _ = http2.ConfigureTransport(insecureHTTP.Transport.(*http.Transport)) +} + func insecureGet(url, version string) (*http.Response, error) { - req, err := http.NewRequest("GET", url, nil) + req, err := http.NewRequest(http.MethodGet, url, nil) if err != nil { return nil, err }