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: Server.ServeTLS docs are wrong about H/2 #24607

Closed
FiloSottile opened this issue Mar 30, 2018 · 2 comments
Closed

net/http: Server.ServeTLS docs are wrong about H/2 #24607

FiloSottile opened this issue Mar 30, 2018 · 2 comments
Labels
Documentation FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@FiloSottile
Copy link
Contributor

For HTTP/2 support, srv.TLSConfig should be initialized to the provided listener's TLS Config before calling ServeTLS. If srv.TLSConfig is non-nil and doesn't include the string "h2" in Config.NextProtos, HTTP/2 support is not enabled.

Since ServeTLS gets to create the tls.Listener, it can initialize the TLSConfig fully, and it does. So the second paragraph is wrong. (Probably because it was copied from Serve #23028.)

Also, ListenAndServeTLS doesn't mention H/2 at all, but applies the same rules as ServeTLS.

The rules are pretty messy, probably worth reviewing all [Server.][ListenAnd]Serve[TLS] docs.

See also #22018

@FiloSottile FiloSottile added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 30, 2018
@FiloSottile FiloSottile added this to the Go1.11 milestone Mar 30, 2018
@gopherbot
Copy link

Change https://golang.org/cl/103815 mentions this issue: net/http: fix and normalize the [Server.][ListenAnd]Serve[TLS] docs

@gopherbot
Copy link

Change https://golang.org/cl/125515 mentions this issue: net/http: update Serve docs on when HTTP/2 is enabled

gopherbot pushed a commit that referenced this issue Jul 24, 2018
The only inaccurate part was the HTTP/2 caveat in Server.ServeTLS, which
only applies to the plain Serve variant.

The restriction implemented in shouldConfigureHTTP2ForServe is not on
the setupHTTP2_ServeTLS codepath because ServeTLS owns the tls.Listener,
so we fix it for the user instead of disabling HTTP/2.

Fixes #24607

Change-Id: Ie5f207d0201f09db27bf81b75535e5f6fdaf91e2
Reviewed-on: https://go-review.googlesource.com/103815
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators Jul 23, 2019
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

2 participants