共计 523 个字符,预计需要花费 2 分钟才能阅读完成。
要害参数:
TLSNextProto
解决方案:
把 TLSNextProto 设置成空 map,这样就不会主动降级,相当于敞开 http2.0
client := &http.Client {
Transport:&http.Transport{TLSNextProto: map[string]func(authority string, c *tls.Conn) http.RoundTripper{},},
}
起因:
来自 https://stackoverflow.com/que…
Starting with Go 1.6, the http package has transparent support for the HTTP/2 protocol when using HTTPS. Programs that must disable HTTP/2 can do so by setting Transport.TLSNextProto (for clients) or Server.TLSNextProto (for servers) to a non-nil, empty map. Alternatively, the following GODEBUG environment variables are currently supported:
正文完