Skip to content

Commit

Permalink
feat(server): remove http1_ method prefixes from `server::conn::http2…
Browse files Browse the repository at this point in the history
…::Builder`

Refs: #3085
  • Loading branch information
Michael-J-Ward authored and seanmonstar committed Dec 28, 2022
1 parent 48e70c6 commit 291ed0b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
26 changes: 13 additions & 13 deletions src/server/conn/http2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl<E> Builder<E> {
/// 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<Option<u32>>) -> &mut Self {
pub fn initial_stream_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
if let Some(sz) = sz.into() {
self.h2_builder.adaptive_window = false;
self.h2_builder.initial_stream_window_size = sz;
Expand All @@ -129,7 +129,7 @@ impl<E> Builder<E> {
/// 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<Option<u32>>,
) -> &mut Self {
Expand All @@ -143,9 +143,9 @@ impl<E> Builder<E> {
/// 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;
Expand All @@ -161,7 +161,7 @@ impl<E> Builder<E> {
/// Passing `None` will do nothing.
///
/// If not set, hyper will use a default.
pub fn http2_max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
pub fn max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
if let Some(sz) = sz.into() {
self.h2_builder.max_frame_size = sz;
}
Expand All @@ -174,7 +174,7 @@ impl<E> Builder<E> {
/// 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<Option<u32>>) -> &mut Self {
pub fn max_concurrent_streams(&mut self, max: impl Into<Option<u32>>) -> &mut Self {
self.h2_builder.max_concurrent_streams = max.into();
self
}
Expand All @@ -188,7 +188,7 @@ impl<E> Builder<E> {
///
/// # Cargo Feature
///
pub fn http2_keep_alive_interval(
pub fn keep_alive_interval(
&mut self,
interval: impl Into<Option<Duration>>,
) -> &mut Self {
Expand All @@ -199,13 +199,13 @@ impl<E> Builder<E> {
/// 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
}
Expand All @@ -217,7 +217,7 @@ impl<E> Builder<E> {
/// # 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
Expand All @@ -226,15 +226,15 @@ impl<E> Builder<E> {
/// 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
}

/// 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
}
Expand Down
12 changes: 6 additions & 6 deletions tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 291ed0b

Please sign in to comment.