From cae278dd008207c330bec171d007c6f5ed9206e6 Mon Sep 17 00:00:00 2001 From: Darhwa <65339668+darhwa@users.noreply.github.com> Date: Fri, 31 Jul 2020 23:51:08 +0800 Subject: [PATCH] Fix http outbound Get correct TLS negotiated protocol when stats setting exists --- proxy/http/client.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/proxy/http/client.go b/proxy/http/client.go index 0121b277..120a5299 100644 --- a/proxy/http/client.go +++ b/proxy/http/client.go @@ -197,8 +197,13 @@ func setUpHTTPTunnel(ctx context.Context, dest net.Destination, target string, u return nil, err } + iConn := rawConn + if statConn, ok := iConn.(*internet.StatCouterConnection); ok { + iConn = statConn.Connection + } + nextProto := "" - if tlsConn, ok := rawConn.(*tls.Conn); ok { + if tlsConn, ok := iConn.(*tls.Conn); ok { if err := tlsConn.Handshake(); err != nil { rawConn.Close() return nil, err