From 9e743b0dca4fbb24d301572ac17288f93e4f60c8 Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Wed, 7 May 2025 11:22:30 +0900 Subject: [PATCH] wip: h3-0.0.8 --- Cargo.lock | 24 +++++++++++++++++++----- rpxy-lib/Cargo.toml | 4 ++-- rpxy-lib/src/error.rs | 7 +++++-- rpxy-lib/src/proxy/proxy_h3.rs | 15 ++++++++++----- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8bae735..46120eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1000,6 +1000,20 @@ name = "h3" version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dfb059a4f28a66f186ed16ad912d142f490676acba59353831d7cb45a96b0d3" +dependencies = [ + "bytes", + "fastrand", + "futures-util", + "http", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "h3" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10872b55cfb02a821b69dc7cf8dc6a71d6af25eb9a79662bec4a9d016056b3be" dependencies = [ "bytes", "fastrand", @@ -1012,13 +1026,13 @@ dependencies = [ [[package]] name = "h3-quinn" -version = "0.0.9" +version = "0.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d482318ae94198fc8e3cbb0b7ba3099c865d744e6ec7c62039ca7b6b6c66fbf" +checksum = "8b2e732c8d91a74731663ac8479ab505042fbf547b9a207213ab7fbcbfc4f8b4" dependencies = [ "bytes", "futures", - "h3", + "h3 0.0.8", "quinn", "tokio", "tokio-util", @@ -2159,7 +2173,7 @@ dependencies = [ "futures", "futures-channel", "futures-util", - "h3", + "h3 0.0.8", "h3-quinn", "hot_reload", "http", @@ -2443,7 +2457,7 @@ version = "0.1.0" dependencies = [ "bytes", "futures", - "h3", + "h3 0.0.7", "s2n-quic", "tracing", ] diff --git a/rpxy-lib/Cargo.toml b/rpxy-lib/Cargo.toml index f7520a4..6b1c76d 100644 --- a/rpxy-lib/Cargo.toml +++ b/rpxy-lib/Cargo.toml @@ -92,8 +92,8 @@ tracing = { version = "0.1.41" } # http/3 quinn = { version = "0.11.7", optional = true } -h3 = { version = "0.0.7", features = ["tracing"], optional = true } -h3-quinn = { version = "0.0.9", optional = true } +h3 = { version = "0.0.8", features = ["tracing"], optional = true } +h3-quinn = { version = "0.0.10", optional = true } s2n-quic = { version = "1.57.0", path = "../submodules/s2n-quic/quic/s2n-quic/", default-features = false, features = [ "provider-tls-rustls", ], optional = true } diff --git a/rpxy-lib/src/error.rs b/rpxy-lib/src/error.rs index 20470ed..4554cb7 100644 --- a/rpxy-lib/src/error.rs +++ b/rpxy-lib/src/error.rs @@ -37,8 +37,11 @@ pub enum RpxyError { // http/3 errors #[cfg(any(feature = "http3-quinn", feature = "http3-s2n"))] - #[error("H3 error: {0}")] - H3Error(#[from] h3::Error), + #[error("h3 connection error: {0}")] + H3ConnectionError(#[from] h3::error::ConnectionError), + #[cfg(any(feature = "http3-quinn", feature = "http3-s2n"))] + #[error("h3 connection error: {0}")] + H3StreamError(#[from] h3::error::StreamError), // #[cfg(feature = "http3-s2n")] // #[error("H3 error: {0}")] // H3Error(#[from] s2n_quic_h3::h3::Error), diff --git a/rpxy-lib/src/proxy/proxy_h3.rs b/rpxy-lib/src/proxy/proxy_h3.rs index 3d5143f..acfe07d 100644 --- a/rpxy-lib/src/proxy/proxy_h3.rs +++ b/rpxy-lib/src/proxy/proxy_h3.rs @@ -49,12 +49,17 @@ where } Err(e) => { warn!("HTTP/3 error on accept incoming connection: {}", e); - match e.get_error_level() { - h3::error::ErrorLevel::ConnectionError => break, - h3::error::ErrorLevel::StreamError => continue, - } + break; } - Ok(Some((req, stream))) => { + // Ok(Some((req, stream))) => { + Ok(Some(req_resolver)) => { + let (req, stream) = match req_resolver.resolve_request().await { + Ok((req, stream)) => (req, stream), + Err(e) => { + warn!("HTTP/3 error on resolve request in stream: {}", e); + continue; + } + }; // We consider the connection count separately from the stream count. // Max clients for h1/h2 = max 'stream' for h3. let request_count = self.globals.request_count.clone();