From ef1adc2f7d288017030f48a1d31aadb366ac0383 Mon Sep 17 00:00:00 2001 From: ysicing Date: Mon, 25 Oct 2021 22:56:27 +0800 Subject: [PATCH] fix(proxy): support for all_proxy variables support for all_proxy variables Signed-off-by: ysicing --- environ/proxy.go | 4 ++++ environ/proxy_test.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/environ/proxy.go b/environ/proxy.go index c779eac..4668c7d 100644 --- a/environ/proxy.go +++ b/environ/proxy.go @@ -23,6 +23,10 @@ func Proxy() map[string]string { environ["https_proxy"] = value environ["HTTPS_PROXY"] = value } + if value := envAnyCase("all_proxy"); value != "" { + environ["all_proxy"] = value + environ["ALL_PROXY"] = value + } return environ } diff --git a/environ/proxy_test.go b/environ/proxy_test.go index 513ef01..44f9dc0 100644 --- a/environ/proxy_test.go +++ b/environ/proxy_test.go @@ -24,6 +24,8 @@ func TestProxy(t *testing.T) { return "http://dummy.http.proxy" case "https_proxy": return "http://dummy.https.proxy" + case "all_proxy": + return "http://dummy.https.proxy" default: return "" } @@ -36,6 +38,8 @@ func TestProxy(t *testing.T) { "HTTP_PROXY": "http://dummy.http.proxy", "https_proxy": "http://dummy.https.proxy", "HTTPS_PROXY": "http://dummy.https.proxy", + "all_proxy": "http://dummy.https.proxy", + "ALL_PROXY": "http://dummy.https.proxy", } b := Proxy() if diff := cmp.Diff(a, b); diff != "" {