Repository navigation
Conversation
Implements the packet-down frame format as specified for stream-down in XTLS#6755 (comment 5720463978): an omittable session id excerpt, an omittable packet seq, a mandatory type (data/padding), a mandatory length, and the payload. The first use is downlink keep-alive, per XTLS#4846: the server sends padding frames while the stream-down response is idle, so a middlebox idle timer does not kill the GET while the uplink carries traffic. packet-down is strictly opt-in and negotiated per request: the client sends X-Packet-Down on stream-down / stream-one requests, the server only frames when it has packetDown configured and the marker is present, and confirms with the same header on the response. Everything stays wire-compatible for clients and servers that do not ask for it.
Member
|
暂时不计划为了这种打断引入帧机制 |
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.
XHTTP: packet-down in stream-down with downlink keep-alive
Follows RPRX's packet-down design in #6755 (comment), which was written while closing the earlier downlink-resume attempt (#6755). That attempt was rejected because "restore connection" is too complex, with latency, ACK and so on. This one does not attempt connection restoration at all. No reconnection, no state machine, nothing to tune: each stream-down GET stays a single request; if the GET dies, the connection dies the ordinary way.
Problem (from #4846)
CDNs kill a stream-down GET on body inactivity. This matters during uploads: with packet-up the uplink posts keep flowing, but the downlink proxy payload only arrives while the origin sends, so during a pure upload the GET idles and gets cut. Same story for any target that goes quiet for a while after responding.
What this PR adds
When enabled on both ends, the stream-down response body is cut into packet-down frames with the five elements from the design comment:
Use today is the first one from the design comment: downlink keep-alive. While the downlink has been idle for a whole period, the server writes a padding frame (base62, in the spirit of tokenish x-padding) instead of staying silent. Everything the dispatcher sends rides in data frames, which is what lets the client tell padding apart from payload safely; the seq keeps the format ready for the future uses listed in the design comment (retransmission, multi-path-down) without another wire change.
h1, h2 and h3 are covered, since the framers sit on the body, not on a specific transport. stream-one gets the same treatment on its single response body. Browser dialer is out of scope for now: it has no place to read the response header that confirms the framing.
Negotiation
Strictly opt-in and per request, so old servers are unaffected and nothing breaks behind middleboxes:
Config
Server side is the same block in the inbound; the server only honors the feature when the client asks.
Not in this PR (deliberately)
Tests
Note: I opened this after #7135 (utls bump), which is currently parked until a tagged utls release per the discussion there.