pull/899/merge
Oliver Bähler 2023-10-30 19:18:32 -06:00 committed by GitHub
commit 0b1bd0b59b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 10 deletions

View File

@ -9,7 +9,6 @@ import (
"io/ioutil" "io/ioutil"
"net" "net"
"net/http" "net/http"
"net/url"
"os" "os"
"os/exec" "os/exec"
"strconv" "strconv"
@ -214,18 +213,10 @@ func HttpRequest(endpoint, method string, contentType interface{}, headers []str
TLSHandshakeTimeout: timeout, TLSHandshakeTimeout: timeout,
Proxy: http.ProxyFromEnvironment, Proxy: http.ProxyFromEnvironment,
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { 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) 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 { if customTLS != nil {
transport.TLSClientConfig.RootCAs = customTLS.RootCAs transport.TLSClientConfig.RootCAs = customTLS.RootCAs
transport.TLSClientConfig.Certificates = customTLS.Certificates transport.TLSClientConfig.Certificates = customTLS.Certificates