Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: document when a Transport will not automatically upgrade to a HTTP/2 Transport #17296

Closed
noblehng opened this issue Sep 30, 2016 · 1 comment
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@noblehng
Copy link

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:

 TLSClientConfig: &tls.Config{
     RootCAs:    pool,
     NextProtos: []string{"h2", "http/1.1"},
},

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 or Dial or DialTLS is set for a http.Transport, the automatically upgrade will not happen. But the current documentation of http.Transport doesn't mention this.

@bradfitz bradfitz added this to the Go1.8 milestone Sep 30, 2016
@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 7, 2016
@gopherbot
Copy link

CL https://golang.org/cl/33094 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 10, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants