net/http: document when a Transport will not automatically upgrade to a HTTP/2 Transport #17296
Labels
Milestone
Comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.1 linux/amd64
What operating system and processor architecture are you using (
go env
)?amd64
What did you do?
I'm trying to pinning a TLS cert for a HTTP/2 server, so I have a custom
http.Transport
with its TLSClientConfig set like:What did you expect to see?
From current documentation,
TLSNextProto
is nil, so the transport should be upgraded to HTTP/2 automatically and the request to the server should success.What did you see instead?
The request failed with:
http2: server: error reading preface from client 127.0.0.1:36682: bogus greeting "GET / HTTP/1.1\r\nHost: 12"
It still use a http/1.1 transport after negotiated for h2.
It turns out that after the change with #14275, if either
TLSClientConfig
orDial
orDialTLS
is set for ahttp.Transport
, the automatically upgrade will not happen. But the current documentation ofhttp.Transport
doesn't mention this.The text was updated successfully, but these errors were encountered: