mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-26 19:39:39 -08:00
fix(http): only use HTTPS_PROXY
This commit is contained in:
parent
cc6ad419cd
commit
413cb97bcd
|
@ -3,6 +3,8 @@ package platform
|
|||
import (
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -12,9 +14,17 @@ type httpClient interface {
|
|||
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 (
|
||||
defaultTransport http.RoundTripper = &http.Transport{
|
||||
Proxy: http.ProxyFromEnvironment,
|
||||
Proxy: Proxy,
|
||||
Dial: (&net.Dialer{
|
||||
Timeout: 10 * time.Second,
|
||||
}).Dial,
|
||||
|
|
Loading…
Reference in a new issue