Skip to content

fix(client): parse CONNECT responses and preserve early data - #313

Closed
hunterinvariants wants to merge 1 commit into
hyperium:masterfrom
hunterinvariants:codex/fix-connect-tunnel-response
Closed

fix(client): parse CONNECT responses and preserve early data#313
hunterinvariants wants to merge 1 commit into
hyperium:masterfrom
hunterinvariants:codex/fix-connect-tunnel-response

Conversation

@hunterinvariants

Copy link
Copy Markdown

The HTTP CONNECT helper previously recognized responses using byte-prefix checks and required the header terminator to occur at the end of a read buffer. This could accept malformed status lines and mishandle data received immediately after a successful CONNECT response.

This change:

  • parses the proxy response with httparse;
  • returns a TunnelConnection<C::Response> that replays bytes read beyond the response headers;
  • delegates the original connection metadata through the buffered connection;
  • adds deterministic regressions for malformed status codes and early tunneled data.

Tunnel<C> now uses TunnelConnection<C::Response> as its Service::Response, since retaining bytes already read from the destination requires a buffered return type.

Verified with the complete all-features test suite.

Fixes hyperium/hyper#4095

@hunterinvariants
hunterinvariants deleted the codex/fix-connect-tunnel-response branch August 21, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HTTP CONNECT proxy tunnel has lax response parsing and loses early data

1 participant