]> Cypherpunks.ru repositories - gostls13.git/commit
crypto/tls: add Config.Clone
authorBrad Fitzpatrick <bradfitz@golang.org>
Tue, 30 Aug 2016 03:19:01 +0000 (03:19 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 1 Sep 2016 04:26:12 +0000 (04:26 +0000)
commitd24f446a90ea94b87591bf16228d7d871fec3d92
treed1a9b8d8f77bd8223ddb7d46c73321569b28e9a0
parentcd0ba4c169b591cc22f51cb61463eb45af7b930d
crypto/tls: add Config.Clone

In Go 1.0, the Config struct consisted only of exported fields.

In Go 1.1, it started to grow private, uncopyable fields (sync.Once,
sync.Mutex, etc).

Ever since, people have been writing their own private Config.Clone
methods, or risking it and doing a language-level shallow copy and
copying the unexported sync variables.

Clean this up and export the Config.clone method as Config.Clone.
This matches the convention of Template.Clone from text/template and
html/template at least.

Fixes #15771
Updates #16228 (needs update in x/net/http2 before fixed)
Updates #16492 (not sure whether @agl wants to do more)

Change-Id: I48c2825d4fef55a75d2f99640a7079c56fce39ca
Reviewed-on: https://go-review.googlesource.com/28075
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
src/crypto/tls/common.go
src/crypto/tls/conn_test.go
src/crypto/tls/handshake_client_test.go
src/crypto/tls/handshake_server_test.go
src/crypto/tls/tls.go
src/crypto/tls/tls_test.go
src/net/http/httptest/server.go
src/net/http/transport.go