Skip to content

Commit 291ed0b

Browse files
Michael-J-Wardseanmonstar
authored andcommittedDec 28, 2022
feat(server): remove http1_ method prefixes from server::conn::http2::Builder
Refs: #3085
1 parent 48e70c6 commit 291ed0b

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed
 

‎src/server/conn/http2.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<E> Builder<E> {
116116
/// If not set, hyper will use a default.
117117
///
118118
/// [spec]: https://http2.github.io/http2-spec/#SETTINGS_INITIAL_WINDOW_SIZE
119-
pub fn http2_initial_stream_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
119+
pub fn initial_stream_window_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
120120
if let Some(sz) = sz.into() {
121121
self.h2_builder.adaptive_window = false;
122122
self.h2_builder.initial_stream_window_size = sz;
@@ -129,7 +129,7 @@ impl<E> Builder<E> {
129129
/// Passing `None` will do nothing.
130130
///
131131
/// If not set, hyper will use a default.
132-
pub fn http2_initial_connection_window_size(
132+
pub fn initial_connection_window_size(
133133
&mut self,
134134
sz: impl Into<Option<u32>>,
135135
) -> &mut Self {
@@ -143,9 +143,9 @@ impl<E> Builder<E> {
143143
/// Sets whether to use an adaptive flow control.
144144
///
145145
/// Enabling this will override the limits set in
146-
/// `http2_initial_stream_window_size` and
147-
/// `http2_initial_connection_window_size`.
148-
pub fn http2_adaptive_window(&mut self, enabled: bool) -> &mut Self {
146+
/// `initial_stream_window_size` and
147+
/// `initial_connection_window_size`.
148+
pub fn adaptive_window(&mut self, enabled: bool) -> &mut Self {
149149
use proto::h2::SPEC_WINDOW_SIZE;
150150

151151
self.h2_builder.adaptive_window = enabled;
@@ -161,7 +161,7 @@ impl<E> Builder<E> {
161161
/// Passing `None` will do nothing.
162162
///
163163
/// If not set, hyper will use a default.
164-
pub fn http2_max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
164+
pub fn max_frame_size(&mut self, sz: impl Into<Option<u32>>) -> &mut Self {
165165
if let Some(sz) = sz.into() {
166166
self.h2_builder.max_frame_size = sz;
167167
}
@@ -174,7 +174,7 @@ impl<E> Builder<E> {
174174
/// Default is no limit (`std::u32::MAX`). Passing `None` will do nothing.
175175
///
176176
/// [spec]: https://http2.github.io/http2-spec/#SETTINGS_MAX_CONCURRENT_STREAMS
177-
pub fn http2_max_concurrent_streams(&mut self, max: impl Into<Option<u32>>) -> &mut Self {
177+
pub fn max_concurrent_streams(&mut self, max: impl Into<Option<u32>>) -> &mut Self {
178178
self.h2_builder.max_concurrent_streams = max.into();
179179
self
180180
}
@@ -188,7 +188,7 @@ impl<E> Builder<E> {
188188
///
189189
/// # Cargo Feature
190190
///
191-
pub fn http2_keep_alive_interval(
191+
pub fn keep_alive_interval(
192192
&mut self,
193193
interval: impl Into<Option<Duration>>,
194194
) -> &mut Self {
@@ -199,13 +199,13 @@ impl<E> Builder<E> {
199199
/// Sets a timeout for receiving an acknowledgement of the keep-alive ping.
200200
///
201201
/// If the ping is not acknowledged within the timeout, the connection will
202-
/// be closed. Does nothing if `http2_keep_alive_interval` is disabled.
202+
/// be closed. Does nothing if `keep_alive_interval` is disabled.
203203
///
204204
/// Default is 20 seconds.
205205
///
206206
/// # Cargo Feature
207207
///
208-
pub fn http2_keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self {
208+
pub fn keep_alive_timeout(&mut self, timeout: Duration) -> &mut Self {
209209
self.h2_builder.keep_alive_timeout = timeout;
210210
self
211211
}
@@ -217,7 +217,7 @@ impl<E> Builder<E> {
217217
/// # Panics
218218
///
219219
/// The value must be no larger than `u32::MAX`.
220-
pub fn http2_max_send_buf_size(&mut self, max: usize) -> &mut Self {
220+
pub fn max_send_buf_size(&mut self, max: usize) -> &mut Self {
221221
assert!(max <= std::u32::MAX as usize);
222222
self.h2_builder.max_send_buffer_size = max;
223223
self
@@ -226,15 +226,15 @@ impl<E> Builder<E> {
226226
/// Enables the [extended CONNECT protocol].
227227
///
228228
/// [extended CONNECT protocol]: https://datatracker.ietf.org/doc/html/rfc8441#section-4
229-
pub fn http2_enable_connect_protocol(&mut self) -> &mut Self {
229+
pub fn enable_connect_protocol(&mut self) -> &mut Self {
230230
self.h2_builder.enable_connect_protocol = true;
231231
self
232232
}
233233

234234
/// Sets the max size of received header frames.
235235
///
236236
/// Default is currently ~16MB, but may change.
237-
pub fn http2_max_header_list_size(&mut self, max: u32) -> &mut Self {
237+
pub fn max_header_list_size(&mut self, max: u32) -> &mut Self {
238238
self.h2_builder.max_header_list_size = max;
239239
self
240240
}

‎tests/server.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2363,8 +2363,8 @@ async fn http2_keep_alive_detects_unresponsive_client() {
23632363

23642364
let err = http2::Builder::new(TokioExecutor)
23652365
.timer(TokioTimer)
2366-
.http2_keep_alive_interval(Duration::from_secs(1))
2367-
.http2_keep_alive_timeout(Duration::from_secs(1))
2366+
.keep_alive_interval(Duration::from_secs(1))
2367+
.keep_alive_timeout(Duration::from_secs(1))
23682368
.serve_connection(socket, unreachable_service())
23692369
.await
23702370
.expect_err("serve_connection should error");
@@ -2381,8 +2381,8 @@ async fn http2_keep_alive_with_responsive_client() {
23812381

23822382
http2::Builder::new(TokioExecutor)
23832383
.timer(TokioTimer)
2384-
.http2_keep_alive_interval(Duration::from_secs(1))
2385-
.http2_keep_alive_timeout(Duration::from_secs(1))
2384+
.keep_alive_interval(Duration::from_secs(1))
2385+
.keep_alive_timeout(Duration::from_secs(1))
23862386
.serve_connection(socket, HelloWorld)
23872387
.await
23882388
.expect("serve_connection");
@@ -2445,8 +2445,8 @@ async fn http2_keep_alive_count_server_pings() {
24452445

24462446
http2::Builder::new(TokioExecutor)
24472447
.timer(TokioTimer)
2448-
.http2_keep_alive_interval(Duration::from_secs(1))
2449-
.http2_keep_alive_timeout(Duration::from_secs(1))
2448+
.keep_alive_interval(Duration::from_secs(1))
2449+
.keep_alive_timeout(Duration::from_secs(1))
24502450
.serve_connection(socket, unreachable_service())
24512451
.await
24522452
.expect("serve_connection");

0 commit comments

Comments
 (0)
Please sign in to comment.