diff --git a/examples/http_proxy.rs b/examples/http_proxy.rs index 695f06e964..0b4a6818b8 100644 --- a/examples/http_proxy.rs +++ b/examples/http_proxy.rs @@ -31,8 +31,8 @@ async fn main() -> Result<(), Box> { tokio::task::spawn(async move { if let Err(err) = http1::Builder::new() - .http1_preserve_header_case(true) - .http1_title_case_headers(true) + .preserve_header_case(true) + .title_case_headers(true) .serve_connection(stream, service_fn(proxy)) .with_upgrades() .await diff --git a/src/server/conn/http1.rs b/src/server/conn/http1.rs index 31652a2421..c8a1653fb0 100644 --- a/src/server/conn/http1.rs +++ b/src/server/conn/http1.rs @@ -224,7 +224,7 @@ impl Builder { /// detects an EOF in the middle of a request. /// /// Default is `false`. - pub fn http1_half_close(&mut self, val: bool) -> &mut Self { + pub fn half_close(&mut self, val: bool) -> &mut Self { self.h1_half_close = val; self } @@ -232,7 +232,7 @@ impl Builder { /// Enables or disables HTTP/1 keep-alive. /// /// Default is true. - pub fn http1_keep_alive(&mut self, val: bool) -> &mut Self { + pub fn keep_alive(&mut self, val: bool) -> &mut Self { self.h1_keep_alive = val; self } @@ -243,7 +243,7 @@ impl Builder { /// Note that this setting does not affect HTTP/2. /// /// Default is false. - pub fn http1_title_case_headers(&mut self, enabled: bool) -> &mut Self { + pub fn title_case_headers(&mut self, enabled: bool) -> &mut Self { self.h1_title_case_headers = enabled; self } @@ -261,7 +261,7 @@ impl Builder { /// Note that this setting does not affect HTTP/2. /// /// Default is false. - pub fn http1_preserve_header_case(&mut self, enabled: bool) -> &mut Self { + pub fn preserve_header_case(&mut self, enabled: bool) -> &mut Self { self.h1_preserve_header_case = enabled; self } @@ -270,7 +270,7 @@ impl Builder { /// transmit the entire header within this time, the connection is closed. /// /// Default is None. - pub fn http1_header_read_timeout(&mut self, read_timeout: Duration) -> &mut Self { + pub fn header_read_timeout(&mut self, read_timeout: Duration) -> &mut Self { self.h1_header_read_timeout = Some(read_timeout); self } @@ -287,7 +287,7 @@ impl Builder { /// /// Default is `auto`. In this mode hyper will try to guess which /// mode to use - pub fn http1_writev(&mut self, val: bool) -> &mut Self { + pub fn writev(&mut self, val: bool) -> &mut Self { self.h1_writev = Some(val); self } diff --git a/src/server/conn/mod.rs b/src/server/conn/mod.rs index be196cfbcc..2e7157c5b8 100644 --- a/src/server/conn/mod.rs +++ b/src/server/conn/mod.rs @@ -30,7 +30,7 @@ //! let (tcp_stream, _) = tcp_listener.accept().await?; //! tokio::task::spawn(async move { //! if let Err(http_err) = http1::Builder::new() -//! .http1_keep_alive(true) +//! .keep_alive(true) //! .serve_connection(tcp_stream, service_fn(hello)) //! .await { //! eprintln!("Error while serving HTTP connection: {}", http_err); diff --git a/tests/server.rs b/tests/server.rs index 266563f6ba..3f33903be1 100644 --- a/tests/server.rs +++ b/tests/server.rs @@ -1247,7 +1247,7 @@ async fn http1_allow_half_close() { let (socket, _) = listener.accept().await.unwrap(); http1::Builder::new() - .http1_half_close(true) + .half_close(true) .serve_connection( socket, service_fn(|_| { @@ -1274,7 +1274,7 @@ async fn disconnect_after_reading_request_before_responding() { let (socket, _) = listener.accept().await.unwrap(); http1::Builder::new() - .http1_half_close(false) + .half_close(false) .serve_connection( socket, service_fn(|_| { @@ -1370,7 +1370,7 @@ async fn header_read_timeout_slow_writes() { let (socket, _) = listener.accept().await.unwrap(); let conn = http1::Builder::new() .timer(TokioTimer) - .http1_header_read_timeout(Duration::from_secs(5)) + .header_read_timeout(Duration::from_secs(5)) .serve_connection( socket, service_fn(|_| { @@ -1445,7 +1445,7 @@ async fn header_read_timeout_slow_writes_multiple_requests() { let (socket, _) = listener.accept().await.unwrap(); let conn = http1::Builder::new() .timer(TokioTimer) - .http1_header_read_timeout(Duration::from_secs(5)) + .header_read_timeout(Duration::from_secs(5)) .serve_connection( socket, service_fn(|_| { @@ -2839,7 +2839,7 @@ impl ServeOptions { .serve_connection(stream, service).await.unwrap(); } else { http1::Builder::new() - .http1_keep_alive(_options.keep_alive) + .keep_alive(_options.keep_alive) .pipeline_flush(_options.pipeline) .serve_connection(stream, service).await.unwrap(); }