net/tshttpproxy: move the TS_DEBUG_FAKE_PROXY_AUTH knob up a level

This commit is contained in:
Brad Fitzpatrick 2020-08-27 08:14:03 -07:00
parent aa1da24f18
commit 2bac125cad
2 changed files with 4 additions and 4 deletions

View File

@ -9,6 +9,7 @@
import (
"net/http"
"net/url"
"os"
)
// sysProxyFromEnv, if non-nil, specifies a platform-specific ProxyFromEnvironment
@ -36,6 +37,9 @@ func ProxyFromEnvironment(req *http.Request) (*url.URL, error) {
// GetAuthHeader returns the Authorization header value to send to proxy u.
func GetAuthHeader(u *url.URL) (string, error) {
if fake := os.Getenv("TS_DEBUG_FAKE_PROXY_AUTH"); fake != "" {
return fake, nil
}
if sysAuthHeader != nil {
return sysAuthHeader(u)
}

View File

@ -14,7 +14,6 @@
"log"
"net/http"
"net/url"
"os"
)
func init() {
@ -25,9 +24,6 @@ func init() {
log.Printf("failed to get proxy Auth header for %v; ignoring: %v", proxyURL, err)
return nil, nil
}
if fake := os.Getenv("TS_DEBUG_FAKE_PROXY_AUTH"); fake != "" {
v = fake
}
if v == "" {
return nil, nil
}