Skip to content

wasmtime-wasi-http: Only inject Host header in the default HTTP/1 send_request path#13138

Merged
pchickey merged 1 commit intobytecodealliance:mainfrom
namse:p2-host-header-h1-only
Apr 20, 2026
Merged

wasmtime-wasi-http: Only inject Host header in the default HTTP/1 send_request path#13138
pchickey merged 1 commit intobytecodealliance:mainfrom
namse:p2-host-header-h1-only

Conversation

@namse
Copy link
Copy Markdown
Contributor

@namse namse commented Apr 19, 2026

Currently, outgoing_handler::handle unconditionally appends a Host header to the hyper::Request before calling WasiHttpView::send_request. This is fine for HTTP/1.1, but embedders that override send_request to dispatch over HTTP/2 (e.g. via hyper_util::client::legacy::Client negotiating h2 through ALPN) end up sending both :authority and a host header on the wire. Per RFC 9113 §8.3.1, clients generating HTTP/2 requests directly should use :authority instead of Host, and strict servers such as Google's GFE reject the stream with RST_STREAM PROTOCOL_ERROR when both appear.

This PR moves the Host insertion out of handle and into default_send_request_handler, which is the only code path in this crate that terminates in hyper::client::conn::http1::handshake. HTTP/1 dispatch preserves the existing behavior, while custom send_request implementations no longer have to strip the header themselves.

@namse namse requested a review from a team as a code owner April 19, 2026 13:35
@pchickey pchickey added this pull request to the merge queue Apr 20, 2026
Merged via the queue into bytecodealliance:main with commit cc84f98 Apr 20, 2026
48 checks passed
@namse namse deleted the p2-host-header-h1-only branch April 21, 2026 00:18
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.

2 participants