fix(vhost): preserve buffered HTTP CONNECT tunnel data (#5556)

* fix(vhost): preserve buffered HTTP CONNECT tunnel data

* test(vhost): cover pipelined CONNECT data and bidirectional tunnel traffic
This commit is contained in:
dhairya
2026-10-09 23:07:48 +08:00
committed by GitHub
parent ab0959868a
commit 9c7d9898b3
2 changed files with 82 additions and 2 deletions
+2 -2
View File
@@ -212,7 +212,7 @@ func (rp *HTTPReverseProxy) connectHandler(rw http.ResponseWriter, req *http.Req
return
}
client, _, err := hj.Hijack()
client, buffered, err := hj.Hijack()
if err != nil {
rw.WriteHeader(http.StatusInternalServerError)
return
@@ -225,7 +225,7 @@ func (rp *HTTPReverseProxy) connectHandler(rw http.ResponseWriter, req *http.Req
return
}
_ = req.Write(remote)
go libio.Join(remote, client)
go libio.Join(remote, libio.WrapReadWriteCloser(buffered.Reader, client, client.Close))
}
func getRequestRouteUser(req *http.Request) string {