Repository: wasmerio/wasmer (language: rust)

Issue:
Make aio-http work with latest python and wasmer



Discussion / hints:

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index 5799a5285cd..f49dec42510 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7377,9 +7377,9 @@ dependencies = [
 
 [[package]]
 name = "webc"
-version = "6.0.0"
+version = "6.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d6cf1915e27168c1ed82f7f0d03f60317648f257fecaf4256a1904428d8e4ccd"
+checksum = "c48441419be082f8d2537c84d8b1f502624d77bc08fbbd09ab17cadfe7f0ac53"
 dependencies = [
  "anyhow",
  "base64",
diff --git a/Cargo.toml b/Cargo.toml
index 3139a4ada41..f106fae036f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -96,7 +96,7 @@ wasmer-config = { path = "./lib/config" }
 wasmer-wasix = { path = "./lib/wasix" }
 
 # Wasmer-owned crates
-webc = { version = "6.0.0", default-features = false, features = ["package"] }
+webc = { version = "6.0.1", default-features = false, features = ["package"] }
 shared-buffer = "0.1.4"
 
 # Third-party crates
diff --git a/lib/wasix/src/syscalls/wasix/fd_pipe.rs b/lib/wasix/src/syscalls/wasix/fd_pipe.rs
index 7faf4518707..2ca80e2fd27 100644
--- a/lib/wasix/src/syscalls/wasix/fd_pipe.rs
+++ b/lib/wasix/src/syscalls/wasix/fd_pipe.rs
@@ -66,7 +66,8 @@ pub fn fd_pipe_internal(
         | Rights::FD_DATASYNC
         | Rights::POLL_FD_READWRITE
         | Rights::SOCK_SEND
-        | Rights::FD_FDSTAT_SET_FLAGS;
+        | Rights::FD_FDSTAT_SET_FLAGS
+        | Rights::FD_FILESTAT_GET;
 
     let fd1 = if let Some(fd) = with_fd1 {
         state


Test patch:
diff --git a/tests/integration/cli/Cargo.toml b/tests/integration/cli/Cargo.toml
index 76fa9dcf3f3..e96cab8350a 100644
--- a/tests/integration/cli/Cargo.toml
+++ b/tests/integration/cli/Cargo.toml
@@ -17,7 +17,7 @@ hex = "0.4.3"
 pretty_assertions.workspace = true
 object = "0.30.0"
 reqwest = { workspace = true, default-features = false, features = ["json", "blocking", "rustls-tls"] }
-tokio = { workspace = true, features = [ "rt", "rt-multi-thread", "macros" ] }
+tokio = { workspace = true, features = [ "rt", "rt-multi-thread", "macros", "process" ] }
 assert_cmd = "2.0.8"
 predicates = "2.1.5"
 once_cell = "1.17.1"
diff --git a/tests/integration/cli/tests/run.rs b/tests/integration/cli/tests/run.rs
index b43f9d3750f..baa0bd00f9d 100644
--- a/tests/integration/cli/tests/run.rs
+++ b/tests/integration/cli/tests/run.rs
@@ -47,6 +47,49 @@ static CACHE_RUST_LOG: Lazy<String> = Lazy::new(|| {
     .join(",")
 });
 
+#[tokio::test]
+async fn aio_http() {
+    let status = tokio::process::Command::new(get_wasmer_path())
+        .kill_on_drop(true)
+        .arg("package")
+        .arg("download")
+        .arg("wasmer-integration-tests/aio-http-hello-world")
+        .arg("-o")
+        .arg("aio-http-hello-world.webc")
+        .arg("--quiet")
+        .spawn()
+        .unwrap()
+        .wait()
+        .await
+        .unwrap();
+
+    assert!(status.success());
+
+    let mut wasmer = tokio::process::Command::new(get_wasmer_path())
+        .kill_on_drop(true)
+        .arg("run")
+        .arg("aio-http-hello-world.webc")
+        .arg("--net")
+        .stdout(Stdio::null())
+        .spawn()
+        .unwrap();
+
+    tokio::time::sleep(std::time::Duration::from_secs(5)).await;
+
+    let rsp = reqwest::Client::new()
+        .get("http://localhost:34343")
+        .send()
+        .await
+        .unwrap();
+
+    let body = rsp.text().await.unwrap();
+
+    assert_eq!(body, "Hello, World!");
+
+    wasmer.kill().await.unwrap();
+    wasmer.wait().await.unwrap();
+}
+
 #[test]
 fn list_cwd() {
     let package = packages().join("list-cwd");