From 832073274376c558c3dd99f286e25fa810033f26 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Fri, 28 Jun 2024 08:33:23 +0000 Subject: [PATCH] SplitHTTP: ok -> ooooooooook (parser in client) https://github.com/XTLS/Xray-core/pull/3479#issuecomment-2196370334 --- transport/internet/splithttp/dialer.go | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/transport/internet/splithttp/dialer.go b/transport/internet/splithttp/dialer.go index 48a29c9c..899f7810 100644 --- a/transport/internet/splithttp/dialer.go +++ b/transport/internet/splithttp/dialer.go @@ -213,14 +213,19 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me return } - // skip "ok" response - trashHeader := []byte{0, 0} - _, err = io.ReadFull(response.Body, trashHeader) - if err != nil { - response.Body.Close() - newError("failed to read initial response").Base(err).WriteToLog() - gotDownResponse.Close() - return + // skip "ooooooooook" response + trashHeader := []byte{0} + for { + _, err = io.ReadFull(response.Body, trashHeader) + if err != nil { + response.Body.Close() + newError("failed to read initial response").Base(err).WriteToLog() + gotDownResponse.Close() + return + } + if trashHeader[0] == 'k' { + break + } } downResponse = response.Body