http: check https certificate against host name

Fixes #1093.

R=agl, agl1
CC=golang-dev
https://golang.org/cl/2115045
This commit is contained in:
Russ Cox 2010-09-11 23:41:12 -04:00
parent 4c5892dcab
commit 657e8dab30

View File

@ -670,3 +670,10 @@ func (c *Conn) PeerCertificates() []*x509.Certificate {
return c.peerCertificates
}
// VerifyHostname checks that the peer certificate chain is valid for
// connecting to host. If so, it returns nil; if not, it returns an os.Error
// describing the problem.
func (c *Conn) VerifyHostname(host string) os.Error {
return c.PeerCertificates()[0].VerifyHostname(host)
}