-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: Transport's automatic http2 too aggressive? #14275
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
Comments
CL https://golang.org/cl/19424 mentions this issue. |
For now, don't enable http2 when Transport.TLSConfig != nil. See background in #14275. Also don't enable http2 when ExpectContinueTimeout is specified for now, in case somebody depends on that functionality. (It is not yet implemented in http2, and was only just added to net/http too in Go 1.6, so nobody would be setting it yet). Updates #14275 Updates #13851 Change-Id: I192d555f5fb0a567bd89b6ad87175bbdd7891ae3 Reviewed-on: https://go-review.googlesource.com/19424 Reviewed-by: Russ Cox <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
Could we have transport inspect its I implemented this code (a |
It does do that, when it's expecting it. Making it look for that after a plaintext HTTP/1.1 dial would be... weird. I would rather add support for HTTPS proxies than make such a weird special-case hack. |
What is left for this bug? |
What about |
HTTP2 is disabled if TLSClientConfig/Dial/DialTLS is specified on Transport See golang/go#14275
HTTP2 is disabled if TLSClientConfig/Dial/DialTLS is specified on Transport See golang/go#14275
Comments on closed issues aren't tracked. |
I was just investigating an internal bug report where Go 1.6 broke user's code. The user's code was like:
In Go 1.5, that TLSClientConfig was untouched. In Go 1.6, the first call to RoundTrip calls http2.ConfigureTransport, which mutates the Transport.TLSClientConfig.
In this user's case, that meant they sent a TLS NextProto of
h2
to the peer, which was accepted, and the peer started speaking http2, but the net/http was trying to make a normal http (not https) request, so http2 wasn't even considered. Then Go's transport was speaking http/1.1 and the server thought it was speaking http2. Fail.Perhaps we need to rethink how the automatic upgrade to http2 works in Go 1.7.
Maybe as an intermediate conservative step for Go 1.6 we don't auto-enable http2 on Transports where TLSClientConfig is populated, so it doesn't surprise people by being mutated. I was also considering disabling it if Dial or DialTLS are populated, but http.DefaultTransport sets Dial, and I don't want to special-case looking at whether the transport == DefaultTransport.
The text was updated successfully, but these errors were encountered: