From db92dd46d61492cc581f18cf428cad6036f2c229 Mon Sep 17 00:00:00 2001 From: Roman Titov Date: Mon, 16 Feb 2026 15:56:16 +0100 Subject: [PATCH 1/2] feat(http2/client): add `max_local_error_reset_streams` option --- src/client/conn/http2.rs | 9 +++++++++ src/proto/h2/client.rs | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/src/client/conn/http2.rs b/src/client/conn/http2.rs index 0efaabe41e..1e964ddef3 100644 --- a/src/client/conn/http2.rs +++ b/src/client/conn/http2.rs @@ -465,6 +465,15 @@ where self } + /// Configures the maximum number of local resets due to protocol errors made by the remote end. + /// + /// This will default to the default value set by the [`h2` crate](https://crates.io/crates/h2). + /// As of v0.4.13, it is 1024. + pub fn max_local_error_reset_streams(&mut self, max: Option) -> &mut Self { + self.h2_builder.max_local_error_reset_streams = Some(max); + self + } + /// Constructs a connection with the configured options and IO. /// See [`client::conn`](crate::client::conn) for more. /// diff --git a/src/proto/h2/client.rs b/src/proto/h2/client.rs index 455c70980c..50d0de2ef5 100644 --- a/src/proto/h2/client.rs +++ b/src/proto/h2/client.rs @@ -74,6 +74,7 @@ pub(crate) struct Config { pub(crate) max_concurrent_reset_streams: Option, pub(crate) max_send_buffer_size: usize, pub(crate) max_pending_accept_reset_streams: Option, + pub(crate) max_local_error_reset_streams: Option>, pub(crate) header_table_size: Option, pub(crate) max_concurrent_streams: Option, } @@ -93,6 +94,7 @@ impl Default for Config { max_concurrent_reset_streams: None, max_send_buffer_size: DEFAULT_MAX_SEND_BUF_SIZE, max_pending_accept_reset_streams: None, + max_local_error_reset_streams: None, header_table_size: None, max_concurrent_streams: None, } @@ -117,6 +119,9 @@ fn new_builder(config: &Config) -> Builder { if let Some(max) = config.max_pending_accept_reset_streams { builder.max_pending_accept_reset_streams(max); } + if let Some(max) = config.max_local_error_reset_streams { + builder.max_local_error_reset_streams(max); + } if let Some(size) = config.header_table_size { builder.header_table_size(size); } From 544a0b8d3b7138a7be8c2cbf1695a570d5f30211 Mon Sep 17 00:00:00 2001 From: Roman Titov Date: Mon, 16 Feb 2026 18:11:07 +0100 Subject: [PATCH 2/2] fixup! feat(http2/client): add `max_local_error_reset_streams` option Review fixes --- src/client/conn/http2.rs | 10 ++++++---- src/proto/h2/client.rs | 8 +++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/client/conn/http2.rs b/src/client/conn/http2.rs index 1e964ddef3..fa6151f160 100644 --- a/src/client/conn/http2.rs +++ b/src/client/conn/http2.rs @@ -467,10 +467,12 @@ where /// Configures the maximum number of local resets due to protocol errors made by the remote end. /// - /// This will default to the default value set by the [`h2` crate](https://crates.io/crates/h2). - /// As of v0.4.13, it is 1024. - pub fn max_local_error_reset_streams(&mut self, max: Option) -> &mut Self { - self.h2_builder.max_local_error_reset_streams = Some(max); + /// See the documentation of [`h2::client::Builder::max_local_error_reset_streams`] for more + /// details. + /// + /// The default value is 1024. + pub fn max_local_error_reset_streams(&mut self, max: impl Into>) -> &mut Self { + self.h2_builder.max_local_error_reset_streams = max.into(); self } diff --git a/src/proto/h2/client.rs b/src/proto/h2/client.rs index 50d0de2ef5..1fcc288c88 100644 --- a/src/proto/h2/client.rs +++ b/src/proto/h2/client.rs @@ -74,7 +74,7 @@ pub(crate) struct Config { pub(crate) max_concurrent_reset_streams: Option, pub(crate) max_send_buffer_size: usize, pub(crate) max_pending_accept_reset_streams: Option, - pub(crate) max_local_error_reset_streams: Option>, + pub(crate) max_local_error_reset_streams: Option, pub(crate) header_table_size: Option, pub(crate) max_concurrent_streams: Option, } @@ -94,7 +94,7 @@ impl Default for Config { max_concurrent_reset_streams: None, max_send_buffer_size: DEFAULT_MAX_SEND_BUF_SIZE, max_pending_accept_reset_streams: None, - max_local_error_reset_streams: None, + max_local_error_reset_streams: Some(1024), header_table_size: None, max_concurrent_streams: None, } @@ -109,6 +109,7 @@ fn new_builder(config: &Config) -> Builder { .initial_connection_window_size(config.initial_conn_window_size) .max_header_list_size(config.max_header_list_size) .max_send_buffer_size(config.max_send_buffer_size) + .max_local_error_reset_streams(config.max_local_error_reset_streams) .enable_push(false); if let Some(max) = config.max_frame_size { builder.max_frame_size(max); @@ -119,9 +120,6 @@ fn new_builder(config: &Config) -> Builder { if let Some(max) = config.max_pending_accept_reset_streams { builder.max_pending_accept_reset_streams(max); } - if let Some(max) = config.max_local_error_reset_streams { - builder.max_local_error_reset_streams(max); - } if let Some(size) = config.header_table_size { builder.header_table_size(size); }