1
0
mirror of https://git.sr.ht/~adnano/go-gemini synced 2024-11-26 14:34:07 +01:00

client: Only get cert if TrustCertificate is set

This commit is contained in:
adnano 2021-03-20 12:54:39 -04:00
parent 03767f7a68
commit dfe8446d49

@ -177,9 +177,9 @@ func (c *Client) dialContext(ctx context.Context, network, addr string) (net.Con
} }
func (c *Client) verifyConnection(cs tls.ConnectionState, hostname string) error { func (c *Client) verifyConnection(cs tls.ConnectionState, hostname string) error {
cert := cs.PeerCertificates[0]
// See if the client trusts the certificate // See if the client trusts the certificate
if c.TrustCertificate != nil { if c.TrustCertificate != nil {
cert := cs.PeerCertificates[0]
return c.TrustCertificate(hostname, cert) return c.TrustCertificate(hostname, cert)
} }
return nil return nil