Skip to content

Commit

Permalink
Merge pull request #469 from wakatime/bugfix/log-systemcertpool-err
Browse files Browse the repository at this point in the history
Log warning on system cert pool error
  • Loading branch information
alanhamlett authored Jun 27, 2021
2 parents c2076c0 + e17f9a0 commit e434f95
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pkg/api/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"crypto/x509"
"net/http"
"time"

"github.com/wakatime/wakatime-cli/pkg/log"
)

// NewTransport initializes a new http.Transport.
Expand Down Expand Up @@ -103,8 +105,14 @@ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=

// CACerts returns a root cert pool with the system's cacerts and LetsEncrypt's root certs.
func CACerts() *x509.CertPool {
certs, _ := x509.SystemCertPool()
certs, err := x509.SystemCertPool()
if err != nil {
log.Warnf("unable to use system cert pool: %s", err)
}

if certs == nil {
log.Warnf("system cert pool empty")

certs = x509.NewCertPool()
}

Expand Down

0 comments on commit e434f95

Please # to comment.