Implement server certificate store
This commit is contained in:
10
client.go
10
client.go
@@ -218,10 +218,8 @@ func (c *Client) Send(req *Request) (*Response, error) {
|
||||
return req.Certificate, nil
|
||||
}
|
||||
// If we have already stored the certificate, return it
|
||||
if c.CertificateStore != nil {
|
||||
if cert, ok := c.CertificateStore[req.Hostname()]; ok {
|
||||
return cert, nil
|
||||
}
|
||||
if cert, err := c.CertificateStore.Lookup(req.Hostname()); err == nil {
|
||||
return cert, nil
|
||||
}
|
||||
return &tls.Certificate{}, nil
|
||||
},
|
||||
@@ -280,10 +278,6 @@ func (c *Client) Send(req *Request) (*Response, error) {
|
||||
if req.Certificate != nil {
|
||||
return resp, nil
|
||||
}
|
||||
// Create the certificate store if it does not exist
|
||||
if c.CertificateStore == nil {
|
||||
c.CertificateStore = CertificateStore{}
|
||||
}
|
||||
if c.GetCertificate != nil {
|
||||
if cert := c.GetCertificate(req.Hostname(), c.CertificateStore); cert != nil {
|
||||
req.Certificate = cert
|
||||
|
||||
Reference in New Issue
Block a user