From 7593b22e2d5af23ace8966fd3bf8dbe08d59f91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Wa=C5=9B?= Date: Mon, 29 May 2023 12:41:35 +0200 Subject: [PATCH] Use default CAs if neither cert or cert path is provided --- trino/trino.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/trino/trino.go b/trino/trino.go index 4b7acf4..454807b 100644 --- a/trino/trino.go +++ b/trino/trino.go @@ -324,15 +324,17 @@ func newConn(dsn string) (*Conn, error) { } } - certPool := x509.NewCertPool() - certPool.AppendCertsFromPEM(cert) - - httpClient = &http.Client{ - Transport: &http.Transport{ - TLSClientConfig: &tls.Config{ - RootCAs: certPool, + if len(cert) != 0 { + certPool := x509.NewCertPool() + certPool.AppendCertsFromPEM(cert) + + httpClient = &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{ + RootCAs: certPool, + }, }, - }, + } } }