Skip to content

Commit

Permalink
make ssl-insecure-skip-verify keep most DefaultTransport defaults
Browse files Browse the repository at this point in the history
http.DefaultTransport is not a "zero" http.Transport,
it has a bunch of default settings like timeouts and keepalives

so just change the TLSClientConfig of the existing DefaultTransport
instead of creating a whole new http.Transport
  • Loading branch information
ploxiln committed Feb 5, 2019
1 parent 09e8dbd commit 84305f7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,18 @@ func parseURL(to_parse string, urltype string, msgs []string) (*url.URL, []strin
}

func (o *Options) Validate() error {
msgs := make([]string, 0)

if o.SSLInsecureSkipVerify {
// TODO: Accept a certificate bundle.
insecureTransport := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
default_transport, ok := http.DefaultTransport.(*http.Transport)
if ok {
default_transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
} else {
msgs = append(msgs, "error setting insecure tls config: DefaultTransport is unexpected type")
}
http.DefaultTransport = insecureTransport
}

msgs := make([]string, 0)
if o.CookieSecret == "" {
msgs = append(msgs, "missing setting: cookie-secret")
}
Expand Down

0 comments on commit 84305f7

Please sign in to comment.