Skip to content

Commit dd638b5

Browse files
authoredOct 20, 2023
fix(http2): change default server max concurrent streams to 200 (#3362)
Closes #3358 BREAKING CHANGE: This is a behavioral change. Consider setting your own maximum.
1 parent 07077e9 commit dd638b5

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed
 

‎src/proto/h2/server.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl Default for Config {
6262
initial_stream_window_size: DEFAULT_STREAM_WINDOW,
6363
max_frame_size: DEFAULT_MAX_FRAME_SIZE,
6464
enable_connect_protocol: false,
65-
max_concurrent_streams: None,
65+
max_concurrent_streams: Some(200),
6666
keep_alive_interval: None,
6767
keep_alive_timeout: Duration::from_secs(20),
6868
max_send_buffer_size: DEFAULT_MAX_SEND_BUF_SIZE,

‎src/server/conn/http2.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ impl<E> Builder<E> {
177177
/// Sets the [`SETTINGS_MAX_CONCURRENT_STREAMS`][spec] option for HTTP2
178178
/// connections.
179179
///
180-
/// Default is no limit (`std::u32::MAX`). Passing `None` will do nothing.
180+
/// Default is 200, but not part of the stability of hyper. It could change
181+
/// in a future release. You are encouraged to set your own limit.
182+
///
183+
/// Passing `None` will remove any limit.
181184
///
182185
/// [spec]: https://httpwg.org/specs/rfc9113.html#SETTINGS_MAX_CONCURRENT_STREAMS
183186
pub fn max_concurrent_streams(&mut self, max: impl Into<Option<u32>>) -> &mut Self {
@@ -191,9 +194,6 @@ impl<E> Builder<E> {
191194
/// Pass `None` to disable HTTP2 keep-alive.
192195
///
193196
/// Default is currently disabled.
194-
///
195-
/// # Cargo Feature
196-
///
197197
pub fn keep_alive_interval(&mut self, interval: impl Into<Option<Duration>>) -> &mut Self {
198198
self.h2_builder.keep_alive_interval = interval.into();
199199
self
@@ -205,9 +205,6 @@ impl<E> Builder<E> {
205205
/// be closed. Does nothing if `keep_alive_interval` is disabled.
206206
///
207207
/// Default is 20 seconds.
208-
///
209-
/// # Cargo Feature
210-
///
211208
pub fn keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self {
212209
self.h2_builder.keep_alive_timeout = timeout;
213210
self

0 commit comments

Comments
 (0)
Please sign in to comment.