File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 "io"
88 "log"
99 "net"
10+ "net/http"
1011 "net/url"
1112 "os"
1213 "path/filepath"
@@ -303,6 +304,14 @@ func readConfig() (*config, error) {
303304 } else {
304305 return nil , errors .Newf ("invalid proxy endpoint: %s" , proxyStr )
305306 }
307+ } else {
308+ // no SRC_PROXY; check for the standard proxy env variables HTTP_PROXY, HTTPS_PROXY, and NO_PROXY
309+ if u , err := http .ProxyFromEnvironment (& http.Request {URL : cfg .endpointURL }); err != nil {
310+ // when there's an error, the value for the env variable is not a legit URL
311+ return nil , errors .Newf ("invalid HTTP_PROXY or HTTPS_PROXY value: %w" , err )
312+ } else {
313+ cfg .proxyURL = u
314+ }
306315 }
307316
308317 cfg .additionalHeaders = parseAdditionalHeaders ()
@@ -343,7 +352,7 @@ func isValidUnixSocket(path string) (bool, error) {
343352 if os .IsNotExist (err ) {
344353 return false , nil
345354 }
346- return false , errors .Newf ("not a UNIX Domain Socket : %v: %w" , path , err )
355+ return false , errors .Newf ("not a UNIX domain socket : %v: %w" , path , err )
347356 }
348357 defer conn .Close ()
349358
You can’t perform that action at this time.
0 commit comments