SplitHTTP: ok -> ooooooooook (parser in client)

https://github.com/XTLS/Xray-core/pull/3479#issuecomment-2196370334
This commit is contained in:
RPRX 2024-06-28 08:33:23 +00:00 committed by 风扇滑翔翼
parent c0f3bf66fd
commit 8320732743
No known key found for this signature in database
GPG key ID: 67746ECEFA41C2B4

View file

@ -213,8 +213,9 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
return
}
// skip "ok" response
trashHeader := []byte{0, 0}
// skip "ooooooooook" response
trashHeader := []byte{0}
for {
_, err = io.ReadFull(response.Body, trashHeader)
if err != nil {
response.Body.Close()
@ -222,6 +223,10 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
gotDownResponse.Close()
return
}
if trashHeader[0] == 'k' {
break
}
}
downResponse = response.Body
gotDownResponse.Close()