Skip to content

net/http: Serve violates tls.Config immutability promise #15908

@FiloSottile

Description

@FiloSottile

From tls.Confg docs:

After one has been passed to a TLS function it must not be modified.

But calling Serve will call setupHTTP2, which calls http2ConfigureServer, which will modify the tls.Config. Since by the time you call Serve you must have already called tls.Listen, the immutability promise is broken.

I don't think anything relies on it yet, but nothing stops someone from for example caching the NextProtos in crypto/tls.Listen or something, breaking the setupHTTP2 magic.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions