mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-21 15:45:01 +00:00
lib/proxy: do not show inline basic auth passwords when logging errors related to proxy_url
This commit is contained in:
parent
bebcb8130c
commit
c0ac740f93
1 changed files with 3 additions and 3 deletions
|
@ -57,7 +57,7 @@ func (u *URL) NewDialFunc(ac *promauth.Config) (fasthttp.DialFunc, error) {
|
||||||
}
|
}
|
||||||
pu := u.url
|
pu := u.url
|
||||||
if pu.Scheme != "http" && pu.Scheme != "https" {
|
if pu.Scheme != "http" && pu.Scheme != "https" {
|
||||||
return nil, fmt.Errorf("unknown scheme=%q for proxy_url=%q, must be http or https", pu.Scheme, pu)
|
return nil, fmt.Errorf("unknown scheme=%q for proxy_url=%q, must be http or https", pu.Scheme, pu.Redacted())
|
||||||
}
|
}
|
||||||
isTLS := pu.Scheme == "https"
|
isTLS := pu.Scheme == "https"
|
||||||
proxyAddr := addMissingPort(pu.Host, isTLS)
|
proxyAddr := addMissingPort(pu.Host, isTLS)
|
||||||
|
@ -76,7 +76,7 @@ func (u *URL) NewDialFunc(ac *promauth.Config) (fasthttp.DialFunc, error) {
|
||||||
dialFunc := func(addr string) (net.Conn, error) {
|
dialFunc := func(addr string) (net.Conn, error) {
|
||||||
proxyConn, err := defaultDialFunc(proxyAddr)
|
proxyConn, err := defaultDialFunc(proxyAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("cannot connect to proxy %q: %w", pu, err)
|
return nil, fmt.Errorf("cannot connect to proxy %q: %w", pu.Redacted(), err)
|
||||||
}
|
}
|
||||||
if isTLS {
|
if isTLS {
|
||||||
tlsCfgLocal := tlsCfg
|
tlsCfgLocal := tlsCfg
|
||||||
|
@ -89,7 +89,7 @@ func (u *URL) NewDialFunc(ac *promauth.Config) (fasthttp.DialFunc, error) {
|
||||||
conn, err := sendConnectRequest(proxyConn, proxyAddr, addr, authHeader)
|
conn, err := sendConnectRequest(proxyConn, proxyAddr, addr, authHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = proxyConn.Close()
|
_ = proxyConn.Close()
|
||||||
return nil, fmt.Errorf("error when sending CONNECT request to proxy %q: %w", pu, err)
|
return nil, fmt.Errorf("error when sending CONNECT request to proxy %q: %w", pu.Redacted(), err)
|
||||||
}
|
}
|
||||||
return conn, nil
|
return conn, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue