TUN-3546: Fix panic in tlsconfig.LoadOriginCA

This commit is contained in:
Adam Chalmers 2020-11-14 20:03:29 -06:00
parent ae4f687754
commit 6159cb536f
1 changed files with 5 additions and 5 deletions

View File

@ -43,7 +43,7 @@ func (o *unixSocketPath) String() string {
} }
func (o *unixSocketPath) start(wg *sync.WaitGroup, log logger.Service, shutdownC <-chan struct{}, errC chan error, cfg OriginRequestConfig) error { func (o *unixSocketPath) start(wg *sync.WaitGroup, log logger.Service, shutdownC <-chan struct{}, errC chan error, cfg OriginRequestConfig) error {
transport, err := newHTTPTransport(o, cfg) transport, err := newHTTPTransport(o, cfg, log)
if err != nil { if err != nil {
return err return err
} }
@ -89,7 +89,7 @@ func (o *localService) address() string {
} }
func (o *localService) start(wg *sync.WaitGroup, log logger.Service, shutdownC <-chan struct{}, errC chan error, cfg OriginRequestConfig) error { func (o *localService) start(wg *sync.WaitGroup, log logger.Service, shutdownC <-chan struct{}, errC chan error, cfg OriginRequestConfig) error {
transport, err := newHTTPTransport(o, cfg) transport, err := newHTTPTransport(o, cfg, log)
if err != nil { if err != nil {
return err return err
} }
@ -198,7 +198,7 @@ func (o *helloWorld) String() string {
// Start starts a HelloWorld server and stores its address in the Service receiver. // Start starts a HelloWorld server and stores its address in the Service receiver.
func (o *helloWorld) start(wg *sync.WaitGroup, log logger.Service, shutdownC <-chan struct{}, errC chan error, cfg OriginRequestConfig) error { func (o *helloWorld) start(wg *sync.WaitGroup, log logger.Service, shutdownC <-chan struct{}, errC chan error, cfg OriginRequestConfig) error {
transport, err := newHTTPTransport(o, cfg) transport, err := newHTTPTransport(o, cfg, log)
if err != nil { if err != nil {
return err return err
} }
@ -274,8 +274,8 @@ func (nrc *NopReadCloser) Close() error {
return nil return nil
} }
func newHTTPTransport(service OriginService, cfg OriginRequestConfig) (*http.Transport, error) { func newHTTPTransport(service OriginService, cfg OriginRequestConfig, log logger.Service) (*http.Transport, error) {
originCertPool, err := tlsconfig.LoadOriginCA(cfg.CAPool, nil) originCertPool, err := tlsconfig.LoadOriginCA(cfg.CAPool, log)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "Error loading cert pool") return nil, errors.Wrap(err, "Error loading cert pool")
} }