Skip to content

http-client: add route-aware redirect handling#31918

Open
bolinfest wants to merge 1 commit into
pr31917from
pr31918
Open

http-client: add route-aware redirect handling#31918
bolinfest wants to merge 1 commit into
pr31917from
pr31918

Conversation

@bolinfest

@bolinfest bolinfest commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Why

Redirects are new requests whose destinations may require different PAC or OS proxy decisions. Leaving redirect handling inside one reqwest client would reuse the original route, while a custom loop also has to preserve reqwest's timeout, method/body, Referer, and credential-stripping behavior.

What changed

  • Follow supported redirects through RouteAwareClientPool so every hop resolves its own complete URL.
  • Preserve one total request timeout across proxy resolution, transport work, and redirect hops.
  • Match reqwest's redirect method/body rules and sanitized Referer behavior.
  • Strip authorization, cookie, and proxy credentials whenever scheme, host, or effective port changes.
  • Reject unsupported redirect schemes and bound redirect chains.
  • Add exact-route, per-hop proxy, credential, timeout, and no-diagnostics privacy coverage.

Review guide

  1. http-client/src/route_aware_redirect.rs contains the redirect transformation and origin rules.
  2. The send loop in route_aware_client_pool.rs applies those rules while re-resolving each hop.
  3. outbound_proxy_tests.rs, route_aware_redirect_tests.rs, and the integration test cover the behavior and privacy invariants.

Validation

  • just test -p codex-http-client
  • Focused privacy and redirect-routing regression tests.

Stack created with Sapling. Best reviewed with ReviewStack.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant