mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-21 15:10:23 +00:00
httpclient: load CA certificates only when required
on Windows x509.SystemCertPool is not implemented and therefore we end uo with an empty certificate pool if we load the CA certificates unconditionally
This commit is contained in:
parent
591bebef0c
commit
7b0ea8f731
1 changed files with 3 additions and 0 deletions
|
@ -83,6 +83,9 @@ func (c *Config) Initialize(configDir string) error {
|
|||
// loadCACerts returns system cert pools and try to add the configured
|
||||
// CA certificates to it
|
||||
func (c *Config) loadCACerts(configDir string) (*x509.CertPool, error) {
|
||||
if len(c.CACertificates) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
rootCAs, err := x509.SystemCertPool()
|
||||
if err != nil {
|
||||
rootCAs = x509.NewCertPool()
|
||||
|
|
Loading…
Reference in a new issue