wasi-http: Allow embedder to manage outgoing connections#7288
Merged
elliottt merged 1 commit intobytecodealliance:mainfrom Oct 18, 2023
Merged
wasi-http: Allow embedder to manage outgoing connections#7288elliottt merged 1 commit intobytecodealliance:mainfrom
elliottt merged 1 commit intobytecodealliance:mainfrom
Conversation
Contributor
Author
|
I was wondering if |
c1f982e to
605d839
Compare
This adds a new `send_request` method to `WasiHttpView`, allowing embedders to override the default implementation with their own if the desire. The default implementation behaves exactly as before. I've also added a few new `wasi-http` tests: one to test the above, and two others to test streaming and concurrency. These tests are ports of the `test_wasi_http_echo` and `test_wasi_http_hash_all` tests in the [Spin](https://github.com/fermyon/spin) integration test suite. The component they instantiate is likewise ported from the Spin `wasi-http-rust-streaming-outgoing-body` component. Fixes bytecodealliance#7259 Signed-off-by: Joel Dice <joel.dice@fermyon.com>
605d839 to
7deaae4
Compare
elliottt
approved these changes
Oct 18, 2023
Member
elliottt
left a comment
There was a problem hiding this comment.
This looks great to me, thank you!
Comment on lines
+59
to
+62
| fn send_request( | ||
| &mut self, | ||
| request: OutgoingRequest, | ||
| ) -> wasmtime::Result<Resource<HostFutureIncomingResponse>> |
Member
There was a problem hiding this comment.
This is so much simpler than what I was assuming we'd need, nice work!
Contributor
|
Yes, thank you Joel, I really like how the design of this worked out. |
dicej
added a commit
to dicej/wasmtime
that referenced
this pull request
Oct 19, 2023
This is a backport of bytecodealliance#7288, minus the tests. The test suite has been refactored since the release-14.0.0 branch was created, so backporting the tests would be complicated and not worth the effort. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
alexcrichton
pushed a commit
that referenced
this pull request
Oct 19, 2023
This is a backport of #7288, minus the tests. The test suite has been refactored since the release-14.0.0 branch was created, so backporting the tests would be complicated and not worth the effort. Signed-off-by: Joel Dice <joel.dice@fermyon.com>
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.
This adds a new
send_requestmethod toWasiHttpView, allowing embedders to override the default implementation with their own if they desire. The default implementation behaves exactly as before.I've also added a few new
wasi-httptests: one to test the above, and two others to test streaming and concurrency. These tests are ports of thetest_wasi_http_echoandtest_wasi_http_hash_alltests in the Spin integration test suite. The component they instantiate is likewise ported from the Spinwasi-http-rust-streaming-outgoing-bodycomponent.Fixes #7259