Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Update the `http` crate to fix an internal panic (#14728)

Alex Crichtonb15b1f7a0d87
diff --git a/Cargo.lock b/Cargo.lock
index cd8f1296c6..e578ea877a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1839,12 +1839,11 @@ dependencies = [
[[package]]
name = "http"
-version = "1.3.1"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565"
+checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0"
dependencies = [
"bytes",
- "fnv",
"itoa",
]
diff --git a/Cargo.toml b/Cargo.toml
index 1fcf121a29..e5482b98d2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -430,7 +430,7 @@ libc = { version = "0.2.190", default-features = true }
file-per-thread-logger = "0.2.0"
tokio = { version = "1.51.1", features = [ "rt", "time" ] }
hyper = "1.9.0"
-http = "1.3.1"
+http = "1.5.0"
http-body = "1.0.1"
http-body-util = "0.1.3"
bytes = { version = "1.11.1", default-features = false }
diff --git a/crates/test-programs/src/bin/p2_http_outbound_request_long_path.rs b/crates/test-programs/src/bin/p2_http_outbound_request_long_path.rs
new file mode 100644
index 0000000000..e456f9ec28
--- /dev/null
+++ b/crates/test-programs/src/bin/p2_http_outbound_request_long_path.rs
@@ -0,0 +1,20 @@
+use test_programs::wasi::http::types::{Method, Scheme};
+
+fn main() {
+ let addr = std::env::var("HTTP_SERVER").unwrap();
+ // A path of at least 65535 bytes before the `?`, which exceeds the maximum
+ // length supported by `http::uri::PathAndQuery`.
+ let path = format!("/{}?some=arg", "é".repeat(u16::MAX as usize + 10));
+ let res = test_programs::http::request(
+ Method::Get,
+ Scheme::Http,
+ &addr,
+ &path,
+ None,
+ None,
+ None,
+ None,
+ None,
+ );
+ println!("{addr} long path: {res:?}");
+}
diff --git a/crates/test-programs/src/bin/p3_http_outbound_request_long_path.rs b/crates/test-programs/src/bin/p3_http_outbound_request_long_path.rs
new file mode 100644
index 0000000000..1cc0e98cf9
--- /dev/null
+++ b/crates/test-programs/src/bin/p3_http_outbound_request_long_path.rs
@@ -0,0 +1,33 @@
+use test_programs::p3::wasi::http::types::{Method, Scheme};
+
+struct Component;
+
+test_programs::p3::export!(Component);
+
+impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
+ async fn run() -> Result<(), ()> {
+ let addr = test_programs::p3::wasi::cli::environment::get_environment()
+ .into_iter()
+ .find_map(|(k, v)| k.eq("HTTP_SERVER").then_some(v))
+ .unwrap();
+ // A path of at least 65535 bytes before the `?`, which exceeds the maximum
+ // length supported by `http::uri::PathAndQuery`.
+ let path = format!("/{}?some=arg", "é".repeat(u16::MAX as usize + 10));
+ let res = test_programs::p3::http::request(
+ Method::Get,
+ Scheme::Http,
+ &addr,
+ &path,
+ None,
+ None,
+ None,
+ None,
+ None,
+ )
+ .await;
+ println!("{addr} long path: {res:?}");
+ Ok(())
+ }
+}
+
+fn main() {}
diff --git a/crates/wasi-http/tests/all/p2/async_.rs b/crates/wasi-http/tests/all/p2/async_.rs
index 90a5ff6dcc..3a04dd7f02 100644
--- a/crates/wasi-http/tests/all/p2/async_.rs
+++ b/crates/wasi-http/tests/all/p2/async_.rs
@@ -62,6 +62,12 @@ async fn p2_http_outbound_request_large_post() -> Result<()> {
run(P2_HTTP_OUTBOUND_REQUEST_LARGE_POST_COMPONENT, &server).await
}
+#[test_log::test(tokio::test(flavor = "multi_thread"))]
+async fn p2_http_outbound_request_long_path() -> Result<()> {
+ let server = Server::http1(1)?;
+ run(P2_HTTP_OUTBOUND_REQUEST_LONG_PATH_COMPONENT, &server).await
+}
+
#[test_log::test(tokio::test(flavor = "multi_thread"))]
async fn p2_http_outbound_request_put() -> Result<()> {
let server = Server::http1(1)?;
diff --git a/crates/wasi-http/tests/all/p2/sync.rs b/crates/wasi-http/tests/all/p2/sync.rs
index edfa44b0dc..fd99b13626 100644
--- a/crates/wasi-http/tests/all/p2/sync.rs
+++ b/crates/wasi-http/tests/all/p2/sync.rs
@@ -60,6 +60,12 @@ fn p2_http_outbound_request_large_post() -> Result<()> {
run(P2_HTTP_OUTBOUND_REQUEST_LARGE_POST_COMPONENT, &server)
}
+#[test_log::test]
+fn p2_http_outbound_request_long_path() -> Result<()> {
+ let server = Server::http1(1)?;
+ run(P2_HTTP_OUTBOUND_REQUEST_LONG_PATH_COMPONENT, &server)
+}
+
#[test_log::test]
fn p2_http_outbound_request_put() -> Result<()> {
let server = Server::http1(1)?;
diff --git a/crates/wasi-http/tests/all/p3/mod.rs b/crates/wasi-http/tests/all/p3/mod.rs
index fbace8277d..2b6737124c 100644
--- a/crates/wasi-http/tests/all/p3/mod.rs
+++ b/crates/wasi-http/tests/all/p3/mod.rs
@@ -222,6 +222,12 @@ async fn p3_http_outbound_request_large_post() -> wasmtime::Result<()> {
run_cli(P3_HTTP_OUTBOUND_REQUEST_LARGE_POST_COMPONENT, &server).await
}
+#[test_log::test(tokio::test(flavor = "multi_thread"))]
+async fn p3_http_outbound_request_long_path() -> wasmtime::Result<()> {
+ let server = Server::http1(1)?;
+ run_cli(P3_HTTP_OUTBOUND_REQUEST_LONG_PATH_COMPONENT, &server).await
+}
+
#[test_log::test(tokio::test(flavor = "multi_thread"))]
async fn p3_http_outbound_request_put() -> wasmtime::Result<()> {
let server = Server::http1(1)?;
diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock
index d5c99431d4..4aa56d89ab 100644
--- a/supply-chain/imports.lock
+++ b/supply-chain/imports.lock
@@ -1069,8 +1069,8 @@ user-id = 55123
user-login = "rust-lang-owner"
[[publisher.http]]
-version = "1.3.1"
-when = "2025-03-11"
+version = "1.5.0"
+when = "2026-07-29"
user-id = 359
user-login = "seanmonstar"
user-name = "Sean McArthur"