diff --git a/src/client/conn/http2.rs b/src/client/conn/http2.rs index 0efaabe41e..fa6151f160 100644 --- a/src/client/conn/http2.rs +++ b/src/client/conn/http2.rs @@ -465,6 +465,17 @@ where self } + /// Configures the maximum number of local resets due to protocol errors made by the remote end. + /// + /// 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 + } + /// 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..1fcc288c88 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: Some(1024), header_table_size: None, max_concurrent_streams: None, } @@ -107,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);