-
Notifications
You must be signed in to change notification settings - Fork 16
Implement an HTTP server framework. #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement an HTTP server framework. #52
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.