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

Comments

Projects
None yet
2 participants
@FiloSottile
Copy link
Member

commented Mar 30, 2018

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 this to the Go1.11 milestone Mar 30, 2018

@gopherbot

This comment has been minimized.

Copy link

commented Mar 30, 2018

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

@gopherbot

This comment has been minimized.

Copy link

commented Jul 23, 2018

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

@gopherbot gopherbot closed this in 214f7ec Jul 23, 2018

gopherbot pushed a commit that referenced this issue Jul 24, 2018

net/http: fix and normalize the [Server.][ListenAnd]Serve[TLS] docs
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.