Skip to content

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

Closed
@FiloSottile

Description

@FiloSottile

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions