diff --git a/src/async_impl/client.rs b/src/async_impl/client.rs index 383b3b3..092d30c 100644 --- a/src/async_impl/client.rs +++ b/src/async_impl/client.rs @@ -78,6 +78,8 @@ struct Config { tls: TlsBackend, http2_only: bool, http1_title_case_headers: bool, + http2_initial_stream_window_size: Option, + http2_initial_connection_window_size: Option, local_address: Option, nodelay: bool, #[cfg(feature = "cookies")] @@ -116,6 +118,8 @@ impl ClientBuilder { tls: TlsBackend::default(), http2_only: false, http1_title_case_headers: false, + http2_initial_stream_window_size: None, + http2_initial_connection_window_size: None, local_address: None, nodelay: false, #[cfg(feature = "cookies")] @@ -215,6 +219,13 @@ impl ClientBuilder { builder.http2_only(true); } + if let Some(http2_initial_stream_window_size) = config.http2_initial_stream_window_size { + builder.http2_initial_stream_window_size(http2_initial_stream_window_size); + } + if let Some(http2_initial_connection_window_size) = config.http2_initial_connection_window_size { + builder.http2_initial_connection_window_size(http2_initial_connection_window_size); + } + builder.max_idle_per_host(config.max_idle_per_host); if config.http1_title_case_headers { @@ -441,6 +452,22 @@ impl ClientBuilder { self } + /// Sets the `SETTINGS_INITIAL_WINDOW_SIZE` option for HTTP2 stream-level flow control. + /// + /// Default is currently 65,535 but may change internally to optimize for common uses. + pub fn http2_initial_stream_window_size(mut self, sz: impl Into>) -> ClientBuilder { + self.config.http2_initial_stream_window_size = sz.into(); + self + } + + /// Sets the max connection-level flow control for HTTP2 + /// + /// Default is currently 65,535 but may change internally to optimize for common uses. + pub fn http2_initial_connection_window_size(mut self, sz: impl Into>) -> ClientBuilder { + self.config.http2_initial_connection_window_size = sz.into(); + self + } + // TCP options /// Set that all sockets have `SO_NODELAY` set to `true`. diff --git a/src/blocking/client.rs b/src/blocking/client.rs index 7d1b14d..9fedf53 100644 --- a/src/blocking/client.rs +++ b/src/blocking/client.rs @@ -261,6 +261,20 @@ impl ClientBuilder { self.with_inner(|inner| inner.http2_prior_knowledge()) } + /// Sets the `SETTINGS_INITIAL_WINDOW_SIZE` option for HTTP2 stream-level flow control. + /// + /// Default is currently 65,535 but may change internally to optimize for common uses. + pub fn http2_initial_stream_window_size(self, sz: impl Into>) -> ClientBuilder { + self.with_inner(|inner| inner.http2_initial_stream_window_size(sz)) + } + + /// Sets the max connection-level flow control for HTTP2 + /// + /// Default is currently 65,535 but may change internally to optimize for common uses. + pub fn http2_initial_connection_window_size(self, sz: impl Into>) -> ClientBuilder { + self.with_inner(|inner| inner.http2_initial_connection_window_size(sz)) + } + // TCP options /// Set that all sockets have `SO_NODELAY` set to `true`.