From cadb5f6d0046941db9b8faa61330f12d46dd9990 Mon Sep 17 00:00:00 2001 From: Allan Zhang Date: Wed, 3 Jan 2024 01:26:13 -0500 Subject: [PATCH] Add `max_pending_accept_reset_streams` This function was in 0.14 but missed in 1.0. The original function was merged [here](https://github.com/hyperium/hyper/pull/3201/files/e8296d1c5bded88a508f1ca1f35791c30803182d) This commit simply copies directly from it. The config part has been merged into hyper 1.0 (https://github.com/hyperium/hyper/pull/3507). This commit completes the re-addition of this missing function. --- Cargo.toml | 3 ++- src/server/conn/auto.rs | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 610f300..1b0a9ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ tower-service ={ version = "0.3", optional = true } tower = { version = "0.4.1", optional = true, features = ["make", "util"] } [dev-dependencies] -hyper = { version = "1.1.0", features = ["full"] } +hyper = { version = "1.2.0", features = ["full"] } bytes = "1" http-body-util = "0.1.0" tokio = { version = "1", features = ["macros", "test-util"] } @@ -75,3 +75,4 @@ __internal_happy_eyeballs_tests = [] [[example]] name = "client" required-features = ["client-legacy", "http1", "tokio"] + diff --git a/src/server/conn/auto.rs b/src/server/conn/auto.rs index 7240808..9ddd406 100644 --- a/src/server/conn/auto.rs +++ b/src/server/conn/auto.rs @@ -661,6 +661,17 @@ impl Http2Builder<'_, E> { Http1Builder { inner: self.inner } } + /// Configures the maximum number of pending reset streams allowed before a GOAWAY will be sent. + /// + /// This will default to the default value set by the [`h2` crate](https://crates.io/crates/h2). + /// As of v0.4.0, it is 20. + /// + /// See for more information. + pub fn max_pending_accept_reset_streams(&mut self, max: impl Into>) -> &mut Self { + self.inner.http2.max_pending_accept_reset_streams(max); + self + } + /// Sets the [`SETTINGS_INITIAL_WINDOW_SIZE`][spec] option for HTTP2 /// stream-level flow control. ///