Skip to content

Commit 5778745

Browse files
authored
feat(client): add HTTP/2 max_local_error_reset_streams option (#4021)
1 parent c36ca8a commit 5778745

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/client/conn/http2.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,17 @@ where
465465
self
466466
}
467467

468+
/// Configures the maximum number of local resets due to protocol errors made by the remote end.
469+
///
470+
/// See the documentation of [`h2::client::Builder::max_local_error_reset_streams`] for more
471+
/// details.
472+
///
473+
/// The default value is 1024.
474+
pub fn max_local_error_reset_streams(&mut self, max: impl Into<Option<usize>>) -> &mut Self {
475+
self.h2_builder.max_local_error_reset_streams = max.into();
476+
self
477+
}
478+
468479
/// Constructs a connection with the configured options and IO.
469480
/// See [`client::conn`](crate::client::conn) for more.
470481
///

src/proto/h2/client.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub(crate) struct Config {
7474
pub(crate) max_concurrent_reset_streams: Option<usize>,
7575
pub(crate) max_send_buffer_size: usize,
7676
pub(crate) max_pending_accept_reset_streams: Option<usize>,
77+
pub(crate) max_local_error_reset_streams: Option<usize>,
7778
pub(crate) header_table_size: Option<u32>,
7879
pub(crate) max_concurrent_streams: Option<u32>,
7980
}
@@ -93,6 +94,7 @@ impl Default for Config {
9394
max_concurrent_reset_streams: None,
9495
max_send_buffer_size: DEFAULT_MAX_SEND_BUF_SIZE,
9596
max_pending_accept_reset_streams: None,
97+
max_local_error_reset_streams: Some(1024),
9698
header_table_size: None,
9799
max_concurrent_streams: None,
98100
}
@@ -107,6 +109,7 @@ fn new_builder(config: &Config) -> Builder {
107109
.initial_connection_window_size(config.initial_conn_window_size)
108110
.max_header_list_size(config.max_header_list_size)
109111
.max_send_buffer_size(config.max_send_buffer_size)
112+
.max_local_error_reset_streams(config.max_local_error_reset_streams)
110113
.enable_push(false);
111114
if let Some(max) = config.max_frame_size {
112115
builder.max_frame_size(max);

0 commit comments

Comments
 (0)