Repository navigation
XHTTP: bound HTTP/1.1 packet uploads and stream request bodies - #7569
Closed
wywywywycloud wants to merge 1 commit into
Closed
wywywywycloud wants to merge 1 commit into
wywywywycloud wants to merge 1 commit into
Conversation
Use a separate HTTP/1.1 upload transport, respect the reorder window and stream pooled buffers with safe stale-connection retries. Cover blocked writes, response errors, ordering and replay. Fix the Windows Hysteria2 integration test by binding the relay directly to an ephemeral UDP port and choosing the server port via UDP while the relay is bound.
wywywywycloud
force-pushed
the
fix/xhttp-h1-upload-order
branch
from
December 5, 2026 00:09
7231a1d to
769b2fe
Compare
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #7568. This branch targets HTTP/1.1 packet-up. See #7572 for HTTP/2 and #7571 for the queue budget.
Changes
Serializing a POST into a memory buffer could fire WroteRequest before a socket was connected. Later packets could run ahead while earlier packets were still waiting to be sent.
Use a separate HTTP/1.1 upload transport, wait for the socket write and account for the response before reusing the connection. Bound the outstanding sequence gap using the configured reorder window. Stream pooled buffers and allow stale-connection replay only while the body is unread.
The commit also fixes a Windows CI failure in the Sudoku/Hysteria2 integration test by binding the relay to an ephemeral UDP port and selecting the server port via UDP while the relay is bound.
Verification
OpenWrt 25.12.5 amd64 VM, two vCPUs, 256 MiB RAM, no swap,
GOMEMLIMIT=28MiB,GOGC=30. The server was unmodified Xray v26.11.9. Each round uploaded 32 MiB plus 23 bytes times the stream index per VLESS/XHTTP packet-up stream. The receiver sent back the SHA-256 of each stream. Rounds ran in one client process with five-second pauses. Memory figures are sampled RssAnon, not total system memory.This branch alone (
769b2fe) passed 96/96 SHA-256 checks over plain HTTP/1.1 in three rounds of 32 parallel streams without an artificial RAM reservation. Peak RssAnon was 30.55 MiB. No failed uploads or server queue overflows appeared.In the earlier 90 MiB reservation test from #7568, main (
919d0ae) was OOM-killed after receiving 71,064,280 bytes. The same HTTP/1.1 fix before the test-only Windows change (7231a1d) completed the eight-then-32-stream workload with 6,068,247,104 bytes received. Separate plain and TLS HTTP/1.1 runs matched all eight digests each.The splithttp package passed three times. Four HTTP/1.1 regression tests passed ten times with the race detector, covering response errors, out-of-order acknowledgements, stale-socket retry and blocked writes. Linux arm64 cross-build passed.
Combined low-memory check
The three single-commit branches (
769b2fe,3bc0585,889c083) merged cleanly into tree80efcd74215b16ccbac413eb811f75eb90a7b53c. With 90 MiB reserved in tmpfs and a 12 MiB available-memory stop threshold, each protocol ran six rounds of 32 concurrent streams without restarting the client between rounds.A separate three-round HTTP/1.1 over TLS run passed 96/96 checks, with a 27.77 MiB peak RssAnon and 16.88 MiB minimum available. No run hit the guard, logged failed uploads or reported a server queue overflow. These are synthetic VM results. Physical ARM64 hardware was not tested.
Codex + Astra 6.2 was used for debbugging and assisted writing the code. The chat will not be included.