diff --git a/src/server/conn/http2.rs b/src/server/conn/http2.rs index 79c53cde43..50cc12ccf9 100644 --- a/src/server/conn/http2.rs +++ b/src/server/conn/http2.rs @@ -116,7 +116,7 @@ impl Builder { /// If not set, hyper will use a default. /// /// [spec]: https://http2.github.io/http2-spec/#SETTINGS_INITIAL_WINDOW_SIZE - pub fn http2_initial_stream_window_size(&mut self, sz: impl Into>) -> &mut Self { + pub fn initial_stream_window_size(&mut self, sz: impl Into>) -> &mut Self { if let Some(sz) = sz.into() { self.h2_builder.adaptive_window = false; self.h2_builder.initial_stream_window_size = sz; @@ -129,7 +129,7 @@ impl Builder { /// Passing `None` will do nothing. /// /// If not set, hyper will use a default. - pub fn http2_initial_connection_window_size( + pub fn initial_connection_window_size( &mut self, sz: impl Into>, ) -> &mut Self { @@ -143,9 +143,9 @@ impl Builder { /// Sets whether to use an adaptive flow control. /// /// Enabling this will override the limits set in - /// `http2_initial_stream_window_size` and - /// `http2_initial_connection_window_size`. - pub fn http2_adaptive_window(&mut self, enabled: bool) -> &mut Self { + /// `initial_stream_window_size` and + /// `initial_connection_window_size`. + pub fn adaptive_window(&mut self, enabled: bool) -> &mut Self { use proto::h2::SPEC_WINDOW_SIZE; self.h2_builder.adaptive_window = enabled; @@ -161,7 +161,7 @@ impl Builder { /// Passing `None` will do nothing. /// /// If not set, hyper will use a default. - pub fn http2_max_frame_size(&mut self, sz: impl Into>) -> &mut Self { + pub fn max_frame_size(&mut self, sz: impl Into>) -> &mut Self { if let Some(sz) = sz.into() { self.h2_builder.max_frame_size = sz; } @@ -174,7 +174,7 @@ impl Builder { /// Default is no limit (`std::u32::MAX`). Passing `None` will do nothing. /// /// [spec]: https://http2.github.io/http2-spec/#SETTINGS_MAX_CONCURRENT_STREAMS - pub fn http2_max_concurrent_streams(&mut self, max: impl Into>) -> &mut Self { + pub fn max_concurrent_streams(&mut self, max: impl Into>) -> &mut Self { self.h2_builder.max_concurrent_streams = max.into(); self } @@ -188,7 +188,7 @@ impl Builder { /// /// # Cargo Feature /// - pub fn http2_keep_alive_interval( + pub fn keep_alive_interval( &mut self, interval: impl Into>, ) -> &mut Self { @@ -199,13 +199,13 @@ impl Builder { /// Sets a timeout for receiving an acknowledgement of the keep-alive ping. /// /// If the ping is not acknowledged within the timeout, the connection will - /// be closed. Does nothing if `http2_keep_alive_interval` is disabled. + /// be closed. Does nothing if `keep_alive_interval` is disabled. /// /// Default is 20 seconds. /// /// # Cargo Feature /// - pub fn http2_keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self { + pub fn keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self { self.h2_builder.keep_alive_timeout = timeout; self } @@ -217,7 +217,7 @@ impl Builder { /// # Panics /// /// The value must be no larger than `u32::MAX`. - pub fn http2_max_send_buf_size(&mut self, max: usize) -> &mut Self { + pub fn max_send_buf_size(&mut self, max: usize) -> &mut Self { assert!(max <= std::u32::MAX as usize); self.h2_builder.max_send_buffer_size = max; self @@ -226,7 +226,7 @@ impl Builder { /// Enables the [extended CONNECT protocol]. /// /// [extended CONNECT protocol]: https://datatracker.ietf.org/doc/html/rfc8441#section-4 - pub fn http2_enable_connect_protocol(&mut self) -> &mut Self { + pub fn enable_connect_protocol(&mut self) -> &mut Self { self.h2_builder.enable_connect_protocol = true; self } @@ -234,7 +234,7 @@ impl Builder { /// Sets the max size of received header frames. /// /// Default is currently ~16MB, but may change. - pub fn http2_max_header_list_size(&mut self, max: u32) -> &mut Self { + pub fn max_header_list_size(&mut self, max: u32) -> &mut Self { self.h2_builder.max_header_list_size = max; self } diff --git a/tests/server.rs b/tests/server.rs index 3f33903be1..1461aa05bf 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -2363,8 +2363,8 @@ async fn http2_keep_alive_detects_unresponsive_client() { let err = http2::Builder::new(TokioExecutor) .timer(TokioTimer) - .http2_keep_alive_interval(Duration::from_secs(1)) - .http2_keep_alive_timeout(Duration::from_secs(1)) + .keep_alive_interval(Duration::from_secs(1)) + .keep_alive_timeout(Duration::from_secs(1)) .serve_connection(socket, unreachable_service()) .await .expect_err("serve_connection should error"); @@ -2381,8 +2381,8 @@ async fn http2_keep_alive_with_responsive_client() { http2::Builder::new(TokioExecutor) .timer(TokioTimer) - .http2_keep_alive_interval(Duration::from_secs(1)) - .http2_keep_alive_timeout(Duration::from_secs(1)) + .keep_alive_interval(Duration::from_secs(1)) + .keep_alive_timeout(Duration::from_secs(1)) .serve_connection(socket, HelloWorld) .await .expect("serve_connection"); @@ -2445,8 +2445,8 @@ async fn http2_keep_alive_count_server_pings() { http2::Builder::new(TokioExecutor) .timer(TokioTimer) - .http2_keep_alive_interval(Duration::from_secs(1)) - .http2_keep_alive_timeout(Duration::from_secs(1)) + .keep_alive_interval(Duration::from_secs(1)) + .keep_alive_timeout(Duration::from_secs(1)) .serve_connection(socket, unreachable_service()) .await .expect("serve_connection");