diff --git a/src/client/conn/http2.rs b/src/client/conn/http2.rs index 48a1eecdfa..dc636b604f 100644 --- a/src/client/conn/http2.rs +++ b/src/client/conn/http2.rs @@ -376,8 +376,8 @@ where /// connection by sending another settings frame updating the value. /// /// Default value of crate `h2`: `false`. - pub fn enable_push(&mut self, enabled: bool) -> &mut Self { - self.h2_builder.enable_push = enabled; + pub fn enable_push(&mut self, enabled: impl Into>) -> &mut Self { + self.h2_builder.enable_push = enabled.into(); self } diff --git a/src/proto/h2/client.rs b/src/proto/h2/client.rs index 2e68099d1d..6ddfaee6bf 100644 --- a/src/proto/h2/client.rs +++ b/src/proto/h2/client.rs @@ -77,7 +77,7 @@ pub(crate) struct Config { pub(crate) max_send_buffer_size: usize, pub(crate) max_pending_accept_reset_streams: Option, pub(crate) header_table_size: Option, - pub(crate) enable_push: bool, + pub(crate) enable_push: Option, pub(crate) max_concurrent_streams: Option, } @@ -97,7 +97,7 @@ impl Default for Config { max_send_buffer_size: DEFAULT_MAX_SEND_BUF_SIZE, max_pending_accept_reset_streams: None, header_table_size: None, - enable_push: false, + enable_push: Some(false), max_concurrent_streams: None, } } @@ -110,8 +110,10 @@ fn new_builder(config: &Config) -> Builder { .initial_window_size(config.initial_stream_window_size) .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) - .enable_push(config.enable_push); + .max_send_buffer_size(config.max_send_buffer_size); + if let Some(enabled) = config.enable_push { + builder.enable_push(enabled); + } if let Some(max) = config.max_frame_size { builder.max_frame_size(max); }