Add http2 window setters to ClientBuilder (#659)
This commit is contained in:
@@ -78,6 +78,8 @@ struct Config {
|
|||||||
tls: TlsBackend,
|
tls: TlsBackend,
|
||||||
http2_only: bool,
|
http2_only: bool,
|
||||||
http1_title_case_headers: bool,
|
http1_title_case_headers: bool,
|
||||||
|
http2_initial_stream_window_size: Option<u32>,
|
||||||
|
http2_initial_connection_window_size: Option<u32>,
|
||||||
local_address: Option<IpAddr>,
|
local_address: Option<IpAddr>,
|
||||||
nodelay: bool,
|
nodelay: bool,
|
||||||
#[cfg(feature = "cookies")]
|
#[cfg(feature = "cookies")]
|
||||||
@@ -116,6 +118,8 @@ impl ClientBuilder {
|
|||||||
tls: TlsBackend::default(),
|
tls: TlsBackend::default(),
|
||||||
http2_only: false,
|
http2_only: false,
|
||||||
http1_title_case_headers: false,
|
http1_title_case_headers: false,
|
||||||
|
http2_initial_stream_window_size: None,
|
||||||
|
http2_initial_connection_window_size: None,
|
||||||
local_address: None,
|
local_address: None,
|
||||||
nodelay: false,
|
nodelay: false,
|
||||||
#[cfg(feature = "cookies")]
|
#[cfg(feature = "cookies")]
|
||||||
@@ -215,6 +219,13 @@ impl ClientBuilder {
|
|||||||
builder.http2_only(true);
|
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);
|
builder.max_idle_per_host(config.max_idle_per_host);
|
||||||
|
|
||||||
if config.http1_title_case_headers {
|
if config.http1_title_case_headers {
|
||||||
@@ -441,6 +452,22 @@ impl ClientBuilder {
|
|||||||
self
|
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<Option<u32>>) -> 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<Option<u32>>) -> ClientBuilder {
|
||||||
|
self.config.http2_initial_connection_window_size = sz.into();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
// TCP options
|
// TCP options
|
||||||
|
|
||||||
/// Set that all sockets have `SO_NODELAY` set to `true`.
|
/// Set that all sockets have `SO_NODELAY` set to `true`.
|
||||||
|
|||||||
@@ -261,6 +261,20 @@ impl ClientBuilder {
|
|||||||
self.with_inner(|inner| inner.http2_prior_knowledge())
|
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<Option<u32>>) -> 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<Option<u32>>) -> ClientBuilder {
|
||||||
|
self.with_inner(|inner| inner.http2_initial_connection_window_size(sz))
|
||||||
|
}
|
||||||
|
|
||||||
// TCP options
|
// TCP options
|
||||||
|
|
||||||
/// Set that all sockets have `SO_NODELAY` set to `true`.
|
/// Set that all sockets have `SO_NODELAY` set to `true`.
|
||||||
|
|||||||
Reference in New Issue
Block a user