Commit a6577fac authored by Brad Fitzpatrick's avatar Brad Fitzpatrick Committed by Tom Bergan

http2: work around Go 1.8 tls.Config.Clone bug

Updates golang/go#19264

Change-Id: Ib5b483d2d830d7a51d59eb7bc5eac106da5d5476
Reviewed-on: https://go-review.googlesource.com/37944
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarTom Bergan <tombergan@google.com>
parent 7bf7a75e
...@@ -12,7 +12,11 @@ import ( ...@@ -12,7 +12,11 @@ import (
"net/http" "net/http"
) )
func cloneTLSConfig(c *tls.Config) *tls.Config { return c.Clone() } func cloneTLSConfig(c *tls.Config) *tls.Config {
c2 := c.Clone()
c2.GetClientCertificate = c.GetClientCertificate // golang.org/issue/19264
return c2
}
var _ http.Pusher = (*responseWriter)(nil) var _ http.Pusher = (*responseWriter)(nil)
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
package http2 package http2
import ( import (
"crypto/tls"
"net/http" "net/http"
"testing" "testing"
"time" "time"
...@@ -64,3 +65,15 @@ func TestConfigureServerIdleTimeout_Go18(t *testing.T) { ...@@ -64,3 +65,15 @@ func TestConfigureServerIdleTimeout_Go18(t *testing.T) {
} }
} }
} }
func TestCertClone(t *testing.T) {
c := &tls.Config{
GetClientCertificate: func(*tls.CertificateRequestInfo) (*tls.Certificate, error) {
panic("shouldn't be called")
},
}
c2 := cloneTLSConfig(c)
if c2.GetClientCertificate == nil {
t.Error("GetClientCertificate is nil")
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment