From bbf4078d1e440739403d97a6134ff06b64b2aaf5 Mon Sep 17 00:00:00 2001 From: Brian Dwyer Date: Sat, 29 Oct 2022 12:45:38 -0400 Subject: [PATCH] Pass request context to proxyDialer --- pkg/gontlm-proxy.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkg/gontlm-proxy.go b/pkg/gontlm-proxy.go index 41c66c6..aa94f8d 100644 --- a/pkg/gontlm-proxy.go +++ b/pkg/gontlm-proxy.go @@ -174,11 +174,8 @@ func Run() { } // HTTPS - proxy.ConnectDial = func(network, addr string) (net.Conn, error) { - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - return proxyDialer("https", addr, proxyUrl)(ctx, network, addr) + proxy.ConnectDialWithReq = func(req *http.Request, network, addr string) (net.Conn, error) { + return proxyDialer("https", addr, proxyUrl)(req.Context(), network, addr) } //