Implement an HTTP server framework.#52
Merged
pchickey merged 19 commits intobytecodealliance:mainfrom Jan 13, 2025
Merged
Conversation
Add a wstd API for creating HTTP server applications, wrapping the WASI proxy world trait and macro. Compiling the example with `RUSTFLAGS="-Clink-arg=--wasi-adapter=proxy"` produces a program that runs in `wasmtime serve`.
This comment was marked as resolved.
This comment was marked as resolved.
pchickey
reviewed
Jan 11, 2025
Contributor
pchickey
left a comment
There was a problem hiding this comment.
This is a lot of really great work! Various quibbles.
src/http/request.rs
Outdated
| .map_err(|_| WasiHttpErrorCode::HttpRequestMethodInvalid)?; | ||
| let scheme = match incoming.scheme() { | ||
| Some(scheme) => Some( | ||
| from_wasi_scheme(scheme).expect("TODO: what shall we do with an invalid uri here?"), |
Contributor
There was a problem hiding this comment.
I think there's a good answer to all of these expect/todos when using wstd::error::Error so can we clean all those up before landing?
To support this, add `Duration::as_millis` and related functions.
pchickey
reviewed
Jan 11, 2025
The client can bubble this into a `wstd::http::Error`. The server currently just does `.expect`, but at least now, if we want it to do something different, it's more clear what the options are.
pchickey
approved these changes
Jan 13, 2025
Contributor
pchickey
left a comment
There was a problem hiding this comment.
This looks good to go, if needed we can golf on some of the error TODOs later without changing any interfaces, so we can land this whenever you are ready.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a wstd API for creating HTTP server applications, wrapping the WASI proxy world trait and macro.
This is split out from #34 to separate it from the client API changes for easier reviewing.