wasi-http icon indicating copy to clipboard operation
wasi-http copied to clipboard

incoming-request-* should return Result<foo>

Open brendandburns opened this issue 2 years ago • 2 comments

Currently the incoming-request-{authority, path, scheme, etc} family of methods currently do not have a way to indicate that an error occurred when fetching the value (e.g. if the request id is unknown)

brendandburns avatar Mar 22 '23 20:03 brendandburns

Is the request id unknown the only possible error here? If so, we can make these fallible for now, but once we have resources, the request will be guaranteed to be valid when it crosses a component boundary (if a bad table index is passed to the cabi, the runtime will trap), so we'll want to note that the result is temporary until resources land

pchickey avatar Mar 22 '23 20:03 pchickey

(sorry for slow reply; back now) As is, the CABI specifies traps (as if executing unreachable) in various cases that suggest fundamental toolchain bugs or corruption on the part of the guest (things like offset/length out of bounds, invalid UTF-8, etc). Once resources/handles are implemented, the CABI will similarly specify a trap when the i32 handle index is out-of-bounds w.r.t the associated table, so I think we should similarly say that is what happens in the current pre-handle state of the world.

lukewagner avatar Mar 27 '23 14:03 lukewagner