fix: preserve HTTP body activity and bound stream cancellation - #18
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
Two moderate issues remain around write-deadline rearming and H2 handoff deadline detection.
Review effort: Lite
Findings: None
What changed in this PR
Improves HTTP body activity tracking and cancellation handling across HTTP, H2, and H3 relay paths.
Changes:
- Preserves activity during progressing bodies while bounding stalled writes.
- Bounds H2 initialization and safely cancels stalled destinations.
- Adds regression coverage and documents timeout and cancellation behavior.
| File | Description |
|---|---|
internal/tunnel/web_server_cancellation_test.go |
Tests stalled H2/H3 destination cleanup. |
internal/tunnel/web_handler.go |
Adds stream and connection cancellation handling. |
internal/tunnel/web_h2_initialization_test.go |
Tests bounded H2 initialization and handoff races. |
internal/tunnel/web_h2_client.go |
Bounds post-TLS H2 setup. |
internal/proxy/relay.go |
Refreshes origin read activity. |
internal/proxy/lifecycle.go |
Tracks HTTP connection activity deadlines. |
internal/proxy/http.go |
Applies activity tracking to forwarded responses. |
internal/proxy/http_activity_test.go |
Tests HTTP activity and deadline behavior. |
internal/proxy/config.go |
Documents HTTP body timeout semantics. |
integration/proxy_activity_test.go |
Adds end-to-end H2 body-activity coverage. |
docs/WEB_COVER.md |
Documents stream cancellation behavior. |
docs/DEPLOYMENT.md |
Documents HTTP body timeout behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Verification
Exact head:
82a05108c141920fb6123ad93d94d37fdf8cf78c.make check,make race,make stealth-tools-check, andgit diff --checkpassed.Remaining boundary
After a clean H3 response FIN, resetting only that stream still cannot interrupt an already blocked destination upload write via the current QUIC API. The slot is released when the destination unblocks or the physical connection closes; documented explicitly. This PR does not claim complete cancellation coverage or browser indistinguishability.
No tag or release is created.
Merged-main verification
Merged as
c372b3d95470772da741483f25c2e7f642bdb31d; its tree is identical to the tested head (b0b86efbc77813efbeff3ee87d76dcbdae26226b). The exact merged main passed CI, CodeQL, and Linux netem, including the container integration step. Local main is fast-forwarded and clean. No tag/release was created.