Server plugin should use default http transport when scheme is not https
This commit is contained in:
parent
fb0c7292ac
commit
c61380584e
@ -43,17 +43,18 @@ type httpPlugin struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewHTTPPluginOptions(options HTTPPluginOptions) Plugin {
|
func NewHTTPPluginOptions(options HTTPPluginOptions) Plugin {
|
||||||
|
var url = fmt.Sprintf("%s%s", options.Addr, options.Path)
|
||||||
|
|
||||||
var client *http.Client
|
var client *http.Client
|
||||||
if options.TLSVerify == false {
|
if strings.HasPrefix(url, "https://") {
|
||||||
tr := &http.Transport{
|
tr := &http.Transport{
|
||||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
|
TLSClientConfig: &tls.Config{InsecureSkipVerify: options.TLSVerify == false},
|
||||||
}
|
}
|
||||||
client = &http.Client{Transport: tr}
|
client = &http.Client{Transport: tr}
|
||||||
} else {
|
} else {
|
||||||
client = &http.Client{}
|
client = &http.Client{}
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = fmt.Sprintf("%s%s", options.Addr, options.Path)
|
|
||||||
if !strings.HasPrefix(url, "https://") && !strings.HasPrefix(url, "http://") {
|
if !strings.HasPrefix(url, "https://") && !strings.HasPrefix(url, "http://") {
|
||||||
url = "http://" + url
|
url = "http://" + url
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user