Bound HTTP/1 request metadata queue under pipelining

Open
#31 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
rust
Domain
networking

Research direction

Start in src/http_proxy.rs at proxy_http1_rewriting and rewrite_request_stream, then trace how request metadata corresponds to ordinary requests, HEAD, interim 1xx responses, Upgrade, and CONNECT. Run the existing HTTP/1 rewriting tests before adding a withheld-response upstream test that proves metadata stays bounded, and include the MAX_HEADER_SIZE + 1 rejection case for the exact 64 KiB boundary.

Written by the indexing model from the issue text.

Description

Follow-up from the post-merge review of #23.

Problem

The HTTP/1 rewriting path creates a tokio::sync::mpsc::unbounded_channel for request/response correspondence. rewrite_request_stream queues one RequestMeta before every forwarded request.

If an upstream continues reading requests but delays its responses, an unauthenticated client can pipeline requests indefinitely. The request pump continues adding metadata while the response pump cannot drain it, allowing per-connection memory growth without a defined bound.

This affects routes using HTTP header rewriting for X-Forwarded-For or JA3/JA4 forwarding.

Location

  • src/http_proxy.rs: proxy_http1_rewriting, rewrite_request_stream
  • Introduced by #23 while fixing Upgrade/CONNECT response correspondence.

Acceptance criteria

  • Replace the unbounded metadata channel with bounded backpressure or enforce a documented maximum number of outstanding pipelined requests.
  • The request pump must stop advancing when the response side reaches that limit.
  • Preserve correct correspondence for ordinary requests, HEAD, interim 1xx responses, Upgrade, and CONNECT.
  • Add a test with an upstream that reads requests but withholds responses, proving queued metadata remains bounded.
  • Include the exact 64 KiB request-header boundary in the test cleanup: MAX_HEADER_SIZE + 1 must be rejected rather than relying on the current 70 KiB case.
Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
11h 49m
Merged PRs (30d)
12

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from HarperFast/symphony

All issues in HarperFast/symphony

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.