Skip to content

Commit 22108c1

Browse files
PR feedback
1 parent 8682538 commit 22108c1

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

https.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var (
3838
HTTPMitmConnect = &ConnectAction{Action: ConnectHTTPMitm, TLSConfig: TLSConfigFromCA(&GoproxyCa)}
3939
RejectConnect = &ConnectAction{Action: ConnectReject, TLSConfig: TLSConfigFromCA(&GoproxyCa)}
4040
httpsRegexp = regexp.MustCompile(`^https:\/\/`)
41-
PerRequestHTTPSProxyHeaderKey = "X-Https-Proxy"
41+
PerRequestHTTPSProxyHeaderKey = "X-Upstream-Https-Proxy"
4242
)
4343

4444
type ConnectAction struct {
@@ -593,10 +593,6 @@ func httpsProxyAddr(reqURL *url.URL, httpsProxy string) (string, error) {
593593
reqSchemeURL.Scheme = "https"
594594

595595
proxyURL, err := cfg.ProxyFunc()(reqSchemeURL)
596-
if err != nil {
597-
return "", err
598-
}
599-
600596
if err != nil {
601597
return "", err
602598
}

proxy_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,12 +774,11 @@ func TestOverrideHttpsProxyAddrsFromEnvWithRequest(t *testing.T) {
774774
TLSClientConfig: acceptAllCerts,
775775
Proxy: http.ProxyURL(egressProxyUrl),
776776
ProxyConnectHeader: map[string][]string{
777-
"X-Https-Proxy": {fakeExternalProxyTestStruct.URL},
777+
goproxy.PerRequestHTTPSProxyHeaderKey: {fakeExternalProxyTestStruct.URL},
778778
},
779779
}
780780
client := &http.Client{Transport: tr}
781781

782-
// r := string(getOrFail(finalDestinationUrl, client, t))
783782
req, err := http.NewRequest("GET", finalDestinationUrl, nil)
784783
if err != nil {
785784
t.Fatal("Unable to construct request!")
@@ -804,7 +803,7 @@ func TestOverrideHttpsProxyAddrsFromEnvWithRequest(t *testing.T) {
804803
}
805804

806805
// Ensuring the external proxy was routed through
807-
if resBody[len(resBody)-14:] != "-externalproxy" {
806+
if !strings.Contains(resBody, "-externalproxy") {
808807
t.Error("Expected the request have been passed through the external proxy on the way to the final destination!")
809808
}
810809

0 commit comments

Comments
 (0)