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

EvanMGates opened this issue Aug 15, 2018 · 4 comments

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

EvanMGates opened this issue Aug 15, 2018 · 4 comments


Copy link

@EvanMGates EvanMGates commented Aug 15, 2018

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

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 this to the Unplanned milestone Aug 16, 2018
Copy link

@andybons andybons commented Aug 16, 2018

@bradfitz bradfitz added the NeedsFix label Aug 16, 2018
@bradfitz bradfitz modified the milestones: Unplanned, Go1.12 Aug 16, 2018
Copy link

@gopherbot gopherbot commented Aug 21, 2018

Change mentions this issue: net/http: restrict automatic HTTP/2 transport when using DialContext

Copy link

@riking 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 gopherbot closed this in 94e7200 Apr 16, 2019
Copy link

@gopherbot gopherbot commented Apr 16, 2019

Change 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-by: Brad Fitzpatrick <>
@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.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.