mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-27 11:59:40 -08:00
fix(http): only use HTTPS_PROXY
This commit is contained in:
parent
cc6ad419cd
commit
413cb97bcd
|
@ -3,6 +3,8 @@ package platform
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -12,9 +14,17 @@ type httpClient interface {
|
||||||
Do(req *http.Request) (*http.Response, error)
|
Do(req *http.Request) (*http.Response, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Proxy(_ *http.Request) (*url.URL, error) {
|
||||||
|
proxyURL := os.Getenv("HTTPS_PROXY")
|
||||||
|
if len(proxyURL) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
return url.Parse(proxyURL)
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
defaultTransport http.RoundTripper = &http.Transport{
|
defaultTransport http.RoundTripper = &http.Transport{
|
||||||
Proxy: http.ProxyFromEnvironment,
|
Proxy: Proxy,
|
||||||
Dial: (&net.Dialer{
|
Dial: (&net.Dialer{
|
||||||
Timeout: 10 * time.Second,
|
Timeout: 10 * time.Second,
|
||||||
}).Dial,
|
}).Dial,
|
||||||
|
|
Loading…
Reference in a new issue