XHTTP: randomize packet-up size per request by wywywywycloud · Pull Request #6824 · XTLS/Xray-core · GitHub
Skip to content

XHTTP: randomize packet-up size per request - #6824

Open
wywywywycloud wants to merge 2 commits into
XTLS:mainfrom
wywywywycloud:fix/xhttp-randomize-packet-size-per-post
Open

wywywywycloud wants to merge 2 commits into
XTLS:mainfrom
wywywywycloud:fix/xhttp-randomize-packet-size-per-post

Conversation

@wywywywycloud

Copy link
Copy Markdown

scMaxEachPostBytes accepts a range, but packet-up currently samples it once when the logical XHTTP connection is created. Every full POST on that connection therefore uses the same body size.

Sample the configured range for each POST instead. The upload pipe uses the range's upper bound for buffering, while fixed-value configurations keep their existing behavior.

The integration test records real packet-up request bodies. It fails with the previous per-connection sampling and verifies that every body stays within the configured limit while full POST sizes vary.

Tests:

  • go test ./transport/internet/splithttp -run 'Test_(maxUpload|packetUpRandomizesPostSizePerRequest)$' -count=20
  • go test -race ./transport/internet/splithttp
  • go run ./infra/vformat/main.go -mode check -pwd ./
  • CGO_ENABLED=0 go build ./main

patterniha pushed a commit to patterniha/Xray-core that referenced this pull request Sep 27, 2026
Early merge of XTLS#6824 (PR head dc46831), squashed, ahead of
it landing upstream: XTLS#6824

Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
@RPRX

RPRX commented Sep 29, 2026

Copy link
Copy Markdown
Member

@Fangliding

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants