From 993a79d9c6fa2d278956d75f867d4500e6f522a8 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 30 May 2019 19:49:33 -0700 Subject: [PATCH] Disable http2 until we have upstream bugs fixed (#7711) We should revert this PR in future once we have upstream bugs fixed regarding http2 behavior --- cmd/http/server.go | 18 ++++++++---------- cmd/rest/client.go | 7 ------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/cmd/http/server.go b/cmd/http/server.go index 78bb3170a..1700e1036 100644 --- a/cmd/http/server.go +++ b/cmd/http/server.go @@ -26,7 +26,6 @@ import ( "time" humanize "github.com/dustin/go-humanize" - "golang.org/x/net/http2" "github.com/minio/minio-go/v6/pkg/set" "github.com/minio/minio/pkg/certs" @@ -56,9 +55,6 @@ const ( // DefaultMaxHeaderBytes - default maximum HTTP header size in bytes. DefaultMaxHeaderBytes = 1 * humanize.MiByte - - // DefaultHTTP2MaxConcurrentStreams - default value for HTTP 2.0 maximum concurrent streams allowed. - DefaultHTTP2MaxConcurrentStreams = 1024 ) // Server - extended http.Server supports multiple addresses to serve and enhanced connection handling. @@ -133,11 +129,6 @@ func (srv *Server) Start() (err error) { // Start servicing with listener. if tlsConfig != nil { - if err = http2.ConfigureServer(&srv.Server, &http2.Server{ - MaxConcurrentStreams: DefaultHTTP2MaxConcurrentStreams, - }); err != nil { - return err - } return srv.Server.Serve(tls.NewListener(listener, tlsConfig)) } return srv.Server.Serve(listener) @@ -211,7 +202,14 @@ func NewServer(addrs []string, handler http.Handler, getCert certs.GetCertificat CipherSuites: defaultCipherSuites, CurvePreferences: secureCurves, MinVersion: tls.VersionTLS12, - NextProtos: []string{"h2", "http/1.1"}, + // Do not edit the next line, protos priority is kept + // on purpose in this manner for HTTP 2.0, we would + // still like HTTP 2.0 clients to negotiate connection + // to server if needed but by default HTTP 1.1 is + // expected. We need to change this in future + // when we wish to go back to HTTP 2.0 as default + // priority for HTTP protocol negotiation. + NextProtos: []string{"http/1.1", "h2"}, } tlsConfig.GetCertificate = getCert } diff --git a/cmd/rest/client.go b/cmd/rest/client.go index 2326f15a2..817cd2d93 100644 --- a/cmd/rest/client.go +++ b/cmd/rest/client.go @@ -28,7 +28,6 @@ import ( "time" xhttp "github.com/minio/minio/cmd/http" - "golang.org/x/net/http2" ) // DefaultRESTTimeout - default RPC timeout is one minute. @@ -118,12 +117,6 @@ func NewClient(url *url.URL, tlsConfig *tls.Config, timeout time.Duration, newAu TLSClientConfig: tlsConfig, DisableCompression: true, } - if tlsConfig != nil { - // If TLS is enabled configure http2 - if err := http2.ConfigureTransport(tr); err != nil { - return nil, err - } - } return &Client{ httpClient: &http.Client{Transport: tr}, httpIdleConnsCloser: tr.CloseIdleConnections,