Browse Source

Disable 0-rtt mechanism for http/1 outbound (#372)

Fix #357

Co-authored-by: August Njam Brong <longran1989@gmail.com>
單dar 于ɦʷa 5 years ago
parent
commit
e3b96a1b56
1 changed files with 6 additions and 5 deletions
  1. 6 5
      proxy/http/client.go

+ 6 - 5
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()