xia-chao opened PR #14656 from xia-chao:fix/wasi-http-trailers-body-error to bytecodealliance:main:
The contract makes this future the place for "trailers received, or an error", but on a body error it reports "no trailers".
This PR sends the error into that future, and adds a test.
Here I choose to leave the real error to the read path; what goes to the future is a synthesizedError::HttpProtocolError, because that keeps the change surface smallest. But the real error could also be sent to the future as a whole, with the read path changed to return the category error.
xia-chao requested rvolosatovs for a review on PR #14656.
xia-chao requested wasmtime-wasi-reviewers for a review on PR #14656.
xia-chao requested wasmtime-core-reviewers for a review on PR #14656.
xia-chao requested dicej for a review on PR #14656.
:cross_mark: xia-chao closed without merge PR #14656.
xia-chao reopened PR #14656 from xia-chao:fix/wasi-http-trailers-body-error to bytecodealliance:main.
xia-chao updated PR #14656.
xia-chao updated PR #14656.
rvolosatovs assigned rvolosatovs to PR #14656.
:memo: rvolosatovs submitted PR review:
Thanks, I think this looks good overall, but there are some improvements we could make. I don't think we can avoid having to report the "real" error in both places, therefore I think we need to wrap the error in an
ArcI noticed that
http_error_codereporting is currently broken on p2, I opened https://github.com/bytecodealliance/wasmtime/pull/14667, which also refactors theerror_to_p2to take a reference, which we'd need here to use theArc
:speech_balloon: rvolosatovs created PR review comment:
This is now redundant, right?
:speech_balloon: rvolosatovs created PR review comment:
Error(Arc<Error>),
:speech_balloon: rvolosatovs created PR review comment:
}; let e = Arc::new(e); if let Some(tx) = tx { let _ = tx.send(StreamEnd::Error(Arc::clone(&e)));
:speech_balloon: rvolosatovs created PR review comment:
match stream.blocking_read(4096) { Ok(buf) if buf.is_empty() => break format!("eof bytes={bytes}"),This is not correct usage according to the spec, since an empty buffer could mean that there are no bytes available at the time.
blocking_readshould never return an empty buffer
:memo: xia-chao submitted PR review.
:speech_balloon: xia-chao created PR review comment:
Yes, the mem::replace above already sets Closed.
xia-chao commented on PR #14656:
Thanks!
All four are fine and I have them ready, I'll push once #14667 lands.
But with the Arc, the read path'shttp-error-codegoes back to none. The error is anArc<Error>now. (I have that ready too.)
xia-chao updated PR #14656 (assigned to rvolosatovs).
xia-chao commented on PR #14656:
Submitted
:thumbs_up: rvolosatovs submitted PR review.
:speech_balloon: rvolosatovs created PR review comment:
technically this should never happen, but I think it's fine to keep it
rvolosatovs added PR #14656 wasi-http: report body errors from future-trailers to the merge queue.
:check: rvolosatovs merged PR #14656.
rvolosatovs removed PR #14656 wasi-http: report body errors from future-trailers from the merge queue.
Last updated: Oct 31 2026 at 23:03 UTC