From e3b96a1b5656cea4af3cfb72489f5b9f00bcc9e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=96=AEdar=20=E4=BA=8E=C9=A6=CA=B7a?= <65339668+darhwa@users.noreply.github.com> Date: Sat, 31 Oct 2020 11:03:46 +0800 Subject: [PATCH] Disable 0-rtt mechanism for http/1 outbound (#372) Fix #357 Co-authored-by: August Njam Brong --- proxy/http/client.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/proxy/http/client.go b/proxy/http/client.go index 745ddcfd9..79a2bd608 100644 --- a/proxy/http/client.go +++ b/proxy/http/client.go @@ -97,6 +97,12 @@ func (c *Client) Process(ctx context.Context, link *transport.Link, dialer inter netConn, err := setUpHTTPTunnel(ctx, dest, targetAddr, user, dialer, firstPayload) if netConn != nil { + if _, ok := netConn.(*http2Conn); !ok { + if _, err := netConn.Write(firstPayload); err != nil { + netConn.Close() + return err + } + } conn = internet.Connection(netConn) } return err @@ -159,11 +165,6 @@ func setUpHTTPTunnel(ctx context.Context, dest net.Destination, target string, u return nil, err } - if _, err := rawConn.Write(firstPayload); err != nil { - rawConn.Close() - return nil, err - } - resp, err := http.ReadResponse(bufio.NewReader(rawConn), req) if err != nil { rawConn.Close()