File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,24 @@ import (
27
27
)
28
28
29
29
func getCertPool () * x509.CertPool {
30
+ rootCAs , _ := x509 .SystemCertPool ()
31
+ if rootCAs == nil {
32
+ // In some systems (like Windows) system cert pool is
33
+ // not supported or no certificates are present on the
34
+ // system - so we create a new cert pool.
35
+ rootCAs = x509 .NewCertPool ()
36
+ }
30
37
caCertFileNames := getMinioServerTLSRootCAs ()
31
- // If CAs certificates are configured we save them to the http.Client RootCAs store
32
- certs := x509 .NewCertPool ()
33
38
for _ , caCert := range caCertFileNames {
34
39
pemData , err := ioutil .ReadFile (caCert )
35
40
if err != nil {
36
41
// logging this error
37
42
log .Println (err )
38
43
continue
39
44
}
40
- certs .AppendCertsFromPEM (pemData )
45
+ rootCAs .AppendCertsFromPEM (pemData )
41
46
}
42
- return certs
47
+ return rootCAs
43
48
}
44
49
45
50
var certPool = getCertPool ()
You can’t perform that action at this time.
0 commit comments