diff --git a/internal/martian/proxy.go b/internal/martian/proxy.go index 5f735eff..86a4c9a0 100644 --- a/internal/martian/proxy.go +++ b/internal/martian/proxy.go @@ -21,7 +21,6 @@ import ( "net" "net/http" "net/url" - "strconv" "sync" "time" @@ -319,17 +318,6 @@ func (p *Proxy) shouldMITM(req *http.Request) bool { return true } -const terminateTLSHeader = "X-Martian-Terminate-Tls" - -func shouldTerminateTLS(req *http.Request) bool { - h := req.Header.Get(terminateTLSHeader) - if h == "" { - return false - } - b, _ := strconv.ParseBool(h) - return b -} - func (p *Proxy) fixRequestScheme(req *http.Request) { if req.URL.Scheme == "" { if proto := req.Header.Get("X-Forwarded-Proto"); proto != "" { diff --git a/internal/martian/proxy_connect.go b/internal/martian/proxy_connect.go index 40603c66..43dca0d7 100644 --- a/internal/martian/proxy_connect.go +++ b/internal/martian/proxy_connect.go @@ -25,6 +25,7 @@ import ( "net" "net/http" "net/url" + "strconv" "github.com/saucelabs/forwarder/dialvia" "github.com/saucelabs/forwarder/internal/martian/log" @@ -182,3 +183,14 @@ func newConnectResponse(req *http.Request) *http.Response { Request: req, } } + +const terminateTLSHeader = "X-Martian-Terminate-Tls" + +func shouldTerminateTLS(req *http.Request) bool { + h := req.Header.Get(terminateTLSHeader) + if h == "" { + return false + } + b, _ := strconv.ParseBool(h) + return b +}