Proxy Corrections

pull/899/head
Oliver Bähler 2020-11-20 21:58:45 +01:00
parent 559e0b9ff4
commit 3045ad951d
No known key found for this signature in database
GPG Key ID: 129FAC1377FF63C4
1 changed files with 1 additions and 10 deletions

View File

@ -10,7 +10,6 @@ import (
"io/ioutil"
"net"
"net/http"
"net/url"
"os"
"os/exec"
"strconv"
@ -211,18 +210,10 @@ func HttpRequest(endpoint, method string, contentType interface{}, headers []str
TLSHandshakeTimeout: timeout,
Proxy: http.ProxyFromEnvironment,
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
// redirect all connections to host specified in url
addr = strings.Split(req.URL.Host, ":")[0] + addr[strings.LastIndex(addr, ":"):]
return dialer.DialContext(ctx, network, addr)
},
}
if Params.GetString("HTTP_PROXY") != "" {
proxyUrl, err := url.Parse(Params.GetString("HTTP_PROXY"))
if err != nil {
return nil, nil, err
}
transport.Proxy = http.ProxyURL(proxyUrl)
}
if customTLS != nil {
transport.TLSClientConfig.RootCAs = customTLS.RootCAs
transport.TLSClientConfig.Certificates = customTLS.Certificates