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: changing Transport.Dial to DialContext opts in to HTTP/2 #27011

Closed
EvanMGates opened this issue Aug 15, 2018 · 4 comments
Closed

net/http: changing Transport.Dial to DialContext opts in to HTTP/2 #27011

EvanMGates opened this issue Aug 15, 2018 · 4 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@EvanMGates
Copy link

What did you do?

We changed http.Client from using the deprecated transport.Dial function to its replacement, transport.DialContext.

What did you expect to see?

Dial and DialContext should behave similarly when using the same parameters.

What did you see instead?

Using DialContext causes Transport to be configured for http/2. The custom dialer DialContext should not automatically enable http2 as specified in the comment at https://github.com/golang/go/blob/go1.10/src/net/http/transport.go#L228.

Does this issue reproduce with the latest release (go1.10.3)?

We noticed this issue in Go 1.10.2 and the offending code hasn't changed in Go 1.10.3.

System details

We deploy our code on linux/amd64.

We will submit a patch for this issue shortly.

@andybons andybons added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 16, 2018
@andybons andybons added this to the Unplanned milestone Aug 16, 2018
@andybons
Copy link
Member

@bradfitz

@bradfitz bradfitz added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 16, 2018
@bradfitz bradfitz modified the milestones: Unplanned, Go1.12 Aug 16, 2018
@gopherbot gopherbot removed the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 16, 2018
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/130256 mentions this issue: net/http: restrict automatic HTTP/2 transport when using DialContext

@riking
Copy link

riking commented Aug 26, 2018

I thought this was specified in reverse, that using Dial instead of DialContext blocks the use of h2?

@andybons andybons modified the milestones: Go1.12, Go1.13 Feb 12, 2019
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/172299 mentions this issue: net/http: rename to ForceAttemptHTTP2

gopherbot pushed a commit that referenced this issue Apr 16, 2019
Transport.DialerAndTLSConfigSupportsHTTP2 was added just earlier
in CL 130256 but we thought of a better name moments after submitting.
ForceAttemptHTTP2 is shorter, more direct, and doesn't constrain what
we can use it with in the future.

Updates #14391
Updates #27011

Change-Id: Ie5fc71bafcbcaa1941b5d49f748b6d710503d477
Reviewed-on: https://go-review.googlesource.com/c/go/+/172299
Reviewed-by: Brad Fitzpatrick <[email protected]>
@golang golang locked and limited conversation to collaborators Apr 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants