Skip to content

Commit

Permalink
XHTTP client: scMaxEachPostBytes should be bigger than buf.Size (8192)
Browse files Browse the repository at this point in the history
To avoid no size limit.
  • Loading branch information
RPRX authored Dec 18, 2024
1 parent 1531897 commit ff8b66a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions transport/internet/splithttp/dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ff8b66a

Please sign in to comment.