From ff8b66aacb0fdfd52c050fd62d73368545ebcd58 Mon Sep 17 00:00:00 2001 From: RPRX <63339210+RPRX@users.noreply.github.com> Date: Wed, 18 Dec 2024 13:25:34 +0000 Subject: [PATCH] XHTTP client: `scMaxEachPostBytes` should be bigger than buf.Size (8192) To avoid no size limit. --- transport/internet/splithttp/dialer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/transport/internet/splithttp/dialer.go b/transport/internet/splithttp/dialer.go index 86c395d0..cc792a1f 100644 --- a/transport/internet/splithttp/dialer.go +++ b/transport/internet/splithttp/dialer.go @@ -409,6 +409,10 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me scMaxEachPostBytes := transportConfiguration.GetNormalizedScMaxEachPostBytes() scMinPostsIntervalMs := transportConfiguration.GetNormalizedScMinPostsIntervalMs() + if scMaxEachPostBytes.From <= buf.Size { + panic("`scMaxEachPostBytes` should be bigger than " + strconv.Itoa(buf.Size)) + } + maxUploadSize := scMaxEachPostBytes.rand() // WithSizeLimit(0) will still allow single bytes to pass, and a lot of // code relies on this behavior. Subtract 1 so that together with