]> Cypherpunks repositories - gostls13.git/commit
net/http: don't modify caller's tls.Config.NextProtos
authorDamien Neil <dneil@google.com>
Tue, 4 Mar 2025 23:20:28 +0000 (15:20 -0800)
committerGopher Robot <gobot@golang.org>
Wed, 5 Mar 2025 00:56:00 +0000 (16:56 -0800)
commit350118666d75445761bef5c45e681415e6d1b326
tree7f282972f103330afe04df64cf7cfe36f8088e6c
parenta1889554fc3e0c15b4a9870b49bf3a0252f80688
net/http: don't modify caller's tls.Config.NextProtos

Clone the input slice before adjusting NextProtos
to add or remove "http/1.1" and "h2" entries,
so as not to modify a slice that the caller might be using.
(We clone the tls.Config that contains the slice, but
that's a shallow clone.)

Fixes #72100

Change-Id: I9f228b8fb6f6f2ca5023179ec114929c002dbda9
Reviewed-on: https://go-review.googlesource.com/c/go/+/654875
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/net/http/serve_test.go
src/net/http/server.go