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

x/net/http2: no way to set timeouts on http2.Transport #45574

Open
mhr3 opened this issue Apr 14, 2021 · 4 comments
Open

x/net/http2: no way to set timeouts on http2.Transport #45574

mhr3 opened this issue Apr 14, 2021 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@mhr3
Copy link

mhr3 commented Apr 14, 2021

I'm using the http2.Transport with a h2c client, which works fine, but there is no way to set timeouts which are normally inherited from regular http.Transport - for example ExpectContinueTimeout, which when using manually constructed http2.Transport{} is always set to 0, and therefore the client doesn't wait for the 100-continue response.

What version of Go are you using (go version)?

$ go version
go version go1.15.2 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOHOSTARCH="amd64"
GOHOSTOS="linux"

What did you do?

Sent a h2c client request with Expect: 100-continue, but the client doesn't wait to send the body because there's no way to set the ExpectContinueTimeout, which means it ends up being 0.

What did you expect to see?

There should be a way to set the timeouts, so the client would have waited to send the request body.

@mknyszek
Copy link
Contributor

CC @bradfitz @tombergan via https://dev.golang.org/owners

(I will also CC @neild)

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 14, 2021
@mknyszek mknyszek added this to the Backlog milestone Apr 14, 2021
@mknyszek mknyszek changed the title x/net/http2: No way to set timeouts on http2.Transport x/net/http2: no way to set timeouts on http2.Transport Apr 14, 2021
@neild
Copy link
Contributor

neild commented Apr 14, 2021

Use http2.ConfigureTransports to construct an http2.Transport with HTTP/1 configuration options.

t1 := &http.Transport{
  ExpectContinueTimeout: 1*time.Second, // for example
}
t2, err := http2.ConfigureTransports(t1)
if err != nil {
  return err
}
t2.DisableCompression = true // for example

@mhr3
Copy link
Author

mhr3 commented Apr 14, 2021

Use http2.ConfigureTransports to construct an http2.Transport with HTTP/1 configuration options.

I've actually tried that, but then the client was refusing to dial the connection, and only now did I try to also set the t2.ConnPool to nil, which seems to work. 🤦🏼

@networkimprov
Copy link

cc @fraenkel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants