Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

build: fix lint errors after golang.org/x/net update

Nick Craig-Woodd3db33c6b7dd
diff --git a/cmd/serve/restic/restic.go b/cmd/serve/restic/restic.go
index 61f6a42cc..ce650a43f 100644
--- a/cmd/serve/restic/restic.go
+++ b/cmd/serve/restic/restic.go
@@ -209,11 +209,13 @@ with a path of ` + "`/<username>/`" + `.
stdout: os.Stdout,
}
- httpSrv := &http2.Server{}
- opts := &http2.ServeConnOpts{
+ // http.Server can't serve a single net.Conn so the
+ // deprecated http2.Server is still needed here.
+ httpSrv := &http2.Server{} //nolint:staticcheck // see above
+ opts := &http2.ServeConnOpts{ //nolint:staticcheck // see above
Handler: s.server.Router(),
}
- httpSrv.ServeConn(conn, opts)
+ httpSrv.ServeConn(conn, opts) //nolint:staticcheck // see above
return nil
}
fs.Logf(s.f, "Serving restic REST API on %s", s.server.URLs())
diff --git a/lib/http/server_test.go b/lib/http/server_test.go
index 41123bb29..f3549c090 100644
--- a/lib/http/server_test.go
+++ b/lib/http/server_test.go
@@ -13,7 +13,6 @@ import (
"testing"
"github.com/stretchr/testify/require"
- "golang.org/x/net/http2"
)
func testEchoHandler(data []byte) http.Handler {
@@ -652,12 +651,11 @@ func TestH2CServer(t *testing.T) {
require.True(t, strings.HasPrefix(url, "http://"), "url should have http scheme (no TLS)")
// Create an HTTP/2 cleartext client
+ var protocols http.Protocols
+ protocols.SetUnencryptedHTTP2(true)
client := &http.Client{
- Transport: &http2.Transport{
- AllowHTTP: true,
- DialTLSContext: func(ctx context.Context, network, addr string, _ *tls.Config) (net.Conn, error) {
- return net.Dial(network, addr)
- },
+ Transport: &http.Transport{
+ Protocols: &protocols,
},
}