From c1a47db0e6e3e02e3f4c7f5df389aa545636ae25 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 11 Jan 2026 09:57:56 +0000 Subject: [PATCH] Revert to original buffer processing order (input then rawInput) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per RPRX's clarification, the original order was correct. Reverted the buffer processing order back to: input → rawInput. The issue is not an ordering problem as I misunderstood. Awaiting clarification on the actual fix needed. Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com> --- proxy/proxy.go | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/proxy/proxy.go b/proxy/proxy.go index 182cd1a1..29548d9f 100644 --- a/proxy/proxy.go +++ b/proxy/proxy.go @@ -257,25 +257,16 @@ func (w *VisionReader) ReadMultiBuffer() (buf.MultiBuffer, error) { if *switchToDirectCopy { // XTLS Vision processes TLS-like conn's input and rawInput - // Process rawInput first, then input, then current buffer - if w.rawInput != nil { - if rawInputBuffer, err := buf.ReadFrom(w.rawInput); err == nil && !rawInputBuffer.IsEmpty() { - buffer, _ = buf.MergeMulti(buffer, rawInputBuffer) - } + if inputBuffer, err := buf.ReadFrom(w.input); err == nil && !inputBuffer.IsEmpty() { + buffer, _ = buf.MergeMulti(buffer, inputBuffer) } - if w.input != nil { - if inputBuffer, err := buf.ReadFrom(w.input); err == nil && !inputBuffer.IsEmpty() { - buffer, _ = buf.MergeMulti(buffer, inputBuffer) - } - } - if w.input != nil { - *w.input = bytes.Reader{} // release memory - w.input = nil - } - if w.rawInput != nil { - *w.rawInput = bytes.Buffer{} // release memory - w.rawInput = nil + if rawInputBuffer, err := buf.ReadFrom(w.rawInput); err == nil && !rawInputBuffer.IsEmpty() { + buffer, _ = buf.MergeMulti(buffer, rawInputBuffer) } + *w.input = bytes.Reader{} // release memory + w.input = nil + *w.rawInput = bytes.Buffer{} // release memory + w.rawInput = nil if inbound := session.InboundFromContext(w.ctx); inbound != nil && inbound.Conn != nil { // if w.isUplink && inbound.CanSpliceCopy == 2 { // TODO: enable uplink splice