From fffe86680e2ed18b31113975f0a84142c3f4000f Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Sat, 20 Mar 2021 12:54:39 -0400 Subject: [PATCH] client: Only get cert if TrustCertificate is set --- client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client.go b/client.go index fae5b14..7c5c372 100644 --- a/client.go +++ b/client.go @@ -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 { - cert := cs.PeerCertificates[0] // See if the client trusts the certificate if c.TrustCertificate != nil { + cert := cs.PeerCertificates[0] return c.TrustCertificate(hostname, cert) } return nil