Fix reading of tls.Config certificates

This commit mostly copies the getCertificate function from crypto/tls to
align our certificate reading with the standard library.

Should fix #458.
This commit is contained in:
Lucas Clemente
2017-03-01 18:33:05 +01:00
parent c26e2bba4b
commit 1bb4a26965
2 changed files with 39 additions and 21 deletions

View File

@@ -84,6 +84,7 @@ var _ = Describe("Proof", func() {
})
It("uses NameToCertificate entries", func() {
config.Certificates = []tls.Certificate{cert, cert} // two entries so the long path is used
config.NameToCertificate = map[string]*tls.Certificate{
"quic.clemente.io": &cert,
}
@@ -94,6 +95,7 @@ var _ = Describe("Proof", func() {
})
It("uses NameToCertificate entries with wildcard", func() {
config.Certificates = []tls.Certificate{cert, cert} // two entries so the long path is used
config.NameToCertificate = map[string]*tls.Certificate{
"*.clemente.io": &cert,
}