Skip to content

Commit ec7e701

Browse files
committed
Keep timeouts, but don't InsecureSkipVerify
Fixes: #3
1 parent 73b6a04 commit ec7e701

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

splunk/splunk.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package splunk
22

33
import (
44
"bytes"
5+
"crypto/tls"
56
"encoding/json"
67
"errors"
78
"net/http"
@@ -41,9 +42,10 @@ type Client struct {
4142
// If an httpClient object is specified it will be used instead of the
4243
// default http.DefaultClient.
4344
func NewClient(httpClient *http.Client, URL string, Token string, Source string, SourceType string, Index string) *Client {
44-
// Use default client
45+
// Create a new client
4546
if httpClient == nil {
46-
httpClient = http.DefaultClient
47+
tr := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: false}}
48+
httpClient = &http.Client{Timeout: time.Second * 20, Transport: tr}
4749
}
4850
hostname, _ := os.Hostname()
4951
c := &Client{

0 commit comments

Comments
 (0)