Stream: git-wasmtime

Topic: wasmtime / issue #14112 p3(http): `request.new` transmiss...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 10 2026 at 20:16):

saulecabrera opened issue #14112:

Consider the following program:

use test_wasm32_wasip3::http::wasi::http::client;
use test_wasm32_wasip3::http::wasi::http::types::{
    ErrorCode, Fields, Method, Request, Response, Scheme,
};
use test_wasm32_wasip3::http::wit_future;
use test_wasm32_wasip3::http::{export, exports::wasi::http::handler::Guest};

struct Component;
export!(Component);

impl Guest for Component {
    async fn handle(_request: Request) -> Result<Response, ErrorCode> {
        let (trailers_tx, trailers_rx) = wit_future::new(|| Ok(None));
        drop(trailers_tx);

        let (request, sent) = Request::new(Fields::new(), None, trailers_rx, None);
        request.set_method(&Method::Get).unwrap();
        request.set_scheme(Some(&Scheme::Http)).unwrap();
        request
            .set_authority(Some("nonexistent.invalid:80"))
            .unwrap();
        request.set_path_with_query(Some("/")).unwrap();

        client::send(request)
            .await
            .expect_err("send to an unresolvable authority should fail");
        assert!(
            sent.await.is_err(),
            "a request that was never transmitted must not report successful transmission"
        );

        let (trailers_tx, trailers_rx) = wit_future::new(|| Ok(None));
        drop(trailers_tx);
        let (response, _sent) = Response::new(Fields::new(), None, trailers_rx);
        response.set_status_code(200).unwrap();
        Ok(response)
    }
}

fn main() {
    unreachable!("main is a stub");
}

It fails the following statement, using wasmtime v46 and main:

 assert!(
            sent.await.is_err(),
            "a request that was never transmitted must not report successful transmission"
        );

Expected behavior

The spec for request.new states:

The returned future resolves to result of transmission of this request

The returned future should resolve to an error, according to the spec.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 10 2026 at 20:16):

saulecabrera added the bug label to Issue #14112.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 10 2026 at 20:26):

saulecabrera commented on issue #14112:

See https://github.com/WebAssembly/wasi-testsuite/pull/283, for more details (it is essentially the same program linked here). Note that I am assuming that my interpretation of the spec is correct for this particular case, if it is not, I am happy to close this and perhaps move the discussion to the WASI repo.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 10 2026 at 20:42):

saulecabrera added the wasi:impl label to Issue #14112.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 11 2026 at 14:33):

alexcrichton added the wasi-http label to Issue #14112.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 11 2026 at 14:34):

alexcrichton commented on issue #14112:

I suppose the way we're interpreting it in Wasmtime right now is that the future is the result of transmitting the body rather than the entire request, and the result on client::send is the result of sending the request. It wouldn't be too too hard to handle this case within Wasmtime though since the behavior is "something got dropped" and we're able to see that and could synthesize a type of error for "didn't actually succeed"

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

adamrk commented on issue #14112:

I can take a look at handling this.


Last updated: Aug 30 2026 at 10:08 UTC