Stream: git-wasmtime

Topic: wasmtime / PR #14659 wasi-http: reject invalid status cod...


view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2026 at 18:31):

xia-chao opened PR #14659 from xia-chao:fix/wasi-http-p2-status-code-range to bytecodealliance:main:

wit says invalid status codes have to fail, but p2 still accepts 600, p3 hasn't for a while. Looks like #12149 only changed p3!

Added the same 100..=599 check to p2 here, plus a small test!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2026 at 18:31):

xia-chao requested rvolosatovs for a review on PR #14659.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 11 2026 at 18:31):

xia-chao requested wasmtime-wasi-reviewers for a review on PR #14659.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 12:05):

:thumbs_up: rvolosatovs submitted PR review:

Thanks!

Just a small nit, it looks like we could avoid having to rename the struct if we did something like this:

diff --git a/crates/wasi-http/src/p2/types_impl.rs b/crates/wasi-http/src/p2/types_impl.rs
index 1bcc592cf0..9bae88c367 100644
--- a/crates/wasi-http/src/p2/types_impl.rs
+++ b/crates/wasi-http/src/p2/types_impl.rs
@@ -1397,13 +1397,13 @@ mod named {

 #[cfg(test)]
 mod tests {
-    use crate::p2::bindings::http::types::HostOutgoingResponse;
-    use crate::p2::types::HostOutgoingResponse as Response;
+    use crate::p2::bindings::http::types::HostOutgoingResponse as _;
+    use crate::p2::types::HostOutgoingResponse;
     use crate::{FieldMap, WasiHttpCtx, WasiHttpCtxView};

-    fn push(view: &mut WasiHttpCtxView<'_>) -> wasmtime::component::Resource<Response> {
+    fn push(view: &mut WasiHttpCtxView<'_>) -> wasmtime::component::Resource<HostOutgoingResponse> {
         view.table
-            .push(Response {
+            .push(HostOutgoingResponse {
                 status: http::StatusCode::OK,
                 headers: FieldMap::new_mutable(1024),
                 body: None,
@@ -1426,7 +1426,7 @@ mod tests {

         for code in [100u16, 199, 200, 599] {
             let id = push(&mut view);
-            let r = HostOutgoingResponse::set_status_code(&mut view, id, code);
+            let r = view.set_status_code(id, code);
             assert!(
                 matches!(r, Ok(Ok(()))),
                 "code {code} should be accepted: {r:?}"
@@ -1435,7 +1435,7 @@ mod tests {

         for code in [0u16, 99, 600, 999, 1000, 65535] {
             let id = push(&mut view);
-            let r = HostOutgoingResponse::set_status_code(&mut view, id, code);
+            let r = view.set_status_code(id, code);
             assert!(
                 matches!(r, Ok(Err(()))),
                 "code {code} should be rejected: {r:?}"

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 13:34):

xia-chao updated PR #14659.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 13:35):

xia-chao commented on PR #14659:

Applied, thanks!

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 16:13):

:thumbs_up: rvolosatovs submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 16:13):

rvolosatovs added PR #14659 wasi-http: reject invalid status codes on the p2 path to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 16:36):

:check: rvolosatovs merged PR #14659.

view this post on Zulip Wasmtime GitHub notifications bot (Oct 12 2026 at 16:36):

rvolosatovs removed PR #14659 wasi-http: reject invalid status codes on the p2 path from the merge queue.


Last updated: Oct 31 2026 at 23:03 UTC