Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
pspieker-stripe committed Dec 6, 2023
1 parent 8682538 commit 22108c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 1 addition & 5 deletions https.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var (
HTTPMitmConnect = &ConnectAction{Action: ConnectHTTPMitm, TLSConfig: TLSConfigFromCA(&GoproxyCa)}
RejectConnect = &ConnectAction{Action: ConnectReject, TLSConfig: TLSConfigFromCA(&GoproxyCa)}
httpsRegexp = regexp.MustCompile(`^https:\/\/`)
PerRequestHTTPSProxyHeaderKey = "X-Https-Proxy"
PerRequestHTTPSProxyHeaderKey = "X-Upstream-Https-Proxy"
)

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

proxyURL, err := cfg.ProxyFunc()(reqSchemeURL)
if err != nil {
return "", err
}

if err != nil {
return "", err
}
Expand Down
5 changes: 2 additions & 3 deletions proxy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,12 +774,11 @@ func TestOverrideHttpsProxyAddrsFromEnvWithRequest(t *testing.T) {
TLSClientConfig: acceptAllCerts,
Proxy: http.ProxyURL(egressProxyUrl),
ProxyConnectHeader: map[string][]string{
"X-Https-Proxy": {fakeExternalProxyTestStruct.URL},
goproxy.PerRequestHTTPSProxyHeaderKey: {fakeExternalProxyTestStruct.URL},
},
}
client := &http.Client{Transport: tr}

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

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

Expand Down

0 comments on commit 22108c1

Please sign in to comment.