diff --git a/ctx.go b/ctx.go index 32a3434f..4180d144 100644 --- a/ctx.go +++ b/ctx.go @@ -18,8 +18,7 @@ type ProxyCtx struct { RoundTripper RoundTripper // Specify a custom connection dialer that will be used only for the current // request, including WebSocket connection upgrades - Dialer func(ctx context.Context, network string, addr string) (net.Conn, error) - InitializeTLS func(rawConn net.Conn, cfg *tls.Config) (net.Conn, error) + Dialer func(ctx context.Context, network string, addr string) (net.Conn, error) // will contain the recent error that occurred while trying to send receive or parse traffic Error error // A handle for the user to keep data in the context, from the call of ReqHandler to the diff --git a/https.go b/https.go index d6149192..126072f2 100644 --- a/https.go +++ b/https.go @@ -662,11 +662,8 @@ func (proxy *ProxyHttpServer) initializeTLSconnection( tlsConfig = c } - if ctx.InitializeTLS != nil { - return ctx.InitializeTLS(targetConn, tlsConfig) - } tlsConn := tls.Client(targetConn, tlsConfig) - if err := tlsConn.Handshake(); err != nil { + if err := tlsConn.HandshakeContext(ctx.Req.Context()); err != nil { return nil, err } return tlsConn, nil