Skip to content

PROP - 221 - Add HTTP greet component example and update WASI integration#227

Merged
drasko merged 4 commits into
absmach:mainfrom
rodneyosodo:fix/221
Jun 16, 2026
Merged

PROP - 221 - Add HTTP greet component example and update WASI integration#227
drasko merged 4 commits into
absmach:mainfrom
rodneyosodo:fix/221

Conversation

@rodneyosodo

Copy link
Copy Markdown
Contributor

What type of PR is this?

This is a bug fix because it fixes the following issue: #221

What does this do?

Registers wasmtime_wasi_http::p2::add_only_http_to_linker_sync in the WASM component linker so that components with custom exports importing wasi:http/* interfaces can instantiate successfully. Previously, only the wasi:cli/run entry point worked with WASI HTTP imports because the HTTP bindings were missing from the linker.

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

Yes — added test_custom_export_with_wasi_http in proplet/src/runtime/wasmtime_runtime.rs that builds an HTTP-greet component with a custom my-function export and verifies instantiation succeeds.

Did you document any new/modified features?

No. The change is internal — WASI HTTP was already documented as supported for proxy tasks; this extends it to custom-export components.

let _ = wasmtime_wasi::p2::add_to_linker_sync(&mut linker)
.map_err(|e| format!("Failed to add WASI P2 to component linker: {e}"));
let _ = wasmtime_wasi_http::p2::add_only_http_to_linker_sync(&mut linker)
.map_err(|e| format!("Failed to add wasi:http to component linker: {e}"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error silently discarded — use ? to propagate linker failure here.

.map_err(|e| format!("Failed to add WASI P2 to component linker: {e}"));
let _ = wasmtime_wasi_http::p2::add_only_http_to_linker_sync(&mut linker)
.map_err(|e| format!("Failed to add wasi:http to component linker: {e}"));
if self.hal_enabled {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grants all WASM workloads unrestricted outbound HTTP — consider an allowlist in WasiHttpHooks.

Build it with: make http-greet-component"
);
return;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test silently passes when binary is missing — panic in CI or use #[ignore].

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
@drasko drasko merged commit 445dbee into absmach:main Jun 16, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Components with custom exports can't use WASI-HTTP

3 participants