From a8f61f2ceb74b2d996859094bfe21f40cb6efbad Mon Sep 17 00:00:00 2001 From: Michael-J-Ward Date: Sat, 24 Dec 2022 12:03:27 -0600 Subject: [PATCH] feat(client): remove http1_ prefixes from `client::conn::http1::Builder` methods Refs: #3085 --- examples/http_proxy.rs | 4 ++-- src/client/conn/http1.rs | 22 +++++++++++----------- src/ext.rs | 4 ++-- tests/client.rs | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/examples/http_proxy.rs b/examples/http_proxy.rs index 7cd4e624f8..695f06e964 100644 --- a/examples/http_proxy.rs +++ b/examples/http_proxy.rs @@ -90,8 +90,8 @@ async fn proxy( let stream = TcpStream::connect(addr).await.unwrap(); let (mut sender, conn) = Builder::new() - .http1_preserve_header_case(true) - .http1_title_case_headers(true) + .preserve_header_case(true) + .title_case_headers(true) .handshake(stream) .await?; tokio::task::spawn(async move { diff --git a/src/client/conn/http1.rs b/src/client/conn/http1.rs index 753e5b59a1..9770af4b8e 100644 --- a/src/client/conn/http1.rs +++ b/src/client/conn/http1.rs @@ -338,7 +338,7 @@ impl Builder { /// Default is false. /// /// [RFC 7230 Section 3.2.4.]: https://tools.ietf.org/html/rfc7230#section-3.2.4 - pub fn http1_allow_spaces_after_header_name_in_responses( + pub fn allow_spaces_after_header_name_in_responses( &mut self, enabled: bool, ) -> &mut Builder { @@ -381,7 +381,7 @@ impl Builder { /// Default is false. /// /// [RFC 7230 Section 3.2.4.]: https://tools.ietf.org/html/rfc7230#section-3.2.4 - pub fn http1_allow_obsolete_multiline_headers_in_responses( + pub fn allow_obsolete_multiline_headers_in_responses( &mut self, enabled: bool, ) -> &mut Builder { @@ -399,7 +399,7 @@ impl Builder { /// Note that this setting does not affect HTTP/2. /// /// Default is false. - pub fn http1_ignore_invalid_headers_in_responses(&mut self, enabled: bool) -> &mut Builder { + pub fn ignore_invalid_headers_in_responses(&mut self, enabled: bool) -> &mut Builder { self.h1_parser_config .ignore_invalid_headers_in_responses(enabled); self @@ -417,7 +417,7 @@ impl Builder { /// /// Default is `auto`. In this mode hyper will try to guess which /// mode to use - pub fn http1_writev(&mut self, enabled: bool) -> &mut Builder { + pub fn writev(&mut self, enabled: bool) -> &mut Builder { self.h1_writev = Some(enabled); self } @@ -428,7 +428,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 Builder { + pub fn title_case_headers(&mut self, enabled: bool) -> &mut Builder { self.h1_title_case_headers = enabled; self } @@ -446,7 +446,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 Builder { + pub fn preserve_header_case(&mut self, enabled: bool) -> &mut Builder { self.h1_preserve_header_case = enabled; self } @@ -461,17 +461,17 @@ impl Builder { /// /// Default is false. #[cfg(feature = "ffi")] - pub fn http1_preserve_header_order(&mut self, enabled: bool) -> &mut Builder { + pub fn preserve_header_order(&mut self, enabled: bool) -> &mut Builder { self.h1_preserve_header_order = enabled; self } /// Sets the exact size of the read buffer to *always* use. /// - /// Note that setting this option unsets the `http1_max_buf_size` option. + /// Note that setting this option unsets the `max_buf_size` option. /// /// Default is an adaptive read buffer. - pub fn http1_read_buf_exact_size(&mut self, sz: Option) -> &mut Builder { + pub fn read_buf_exact_size(&mut self, sz: Option) -> &mut Builder { self.h1_read_buf_exact_size = sz; self.h1_max_buf_size = None; self @@ -481,12 +481,12 @@ impl Builder { /// /// Default is ~400kb. /// - /// Note that setting this option unsets the `http1_read_exact_buf_size` option. + /// Note that setting this option unsets the `read_exact_buf_size` option. /// /// # Panics /// /// The minimum value allowed is 8192. This method panics if the passed `max` is less than the minimum. - pub fn http1_max_buf_size(&mut self, max: usize) -> &mut Self { + pub fn max_buf_size(&mut self, max: usize) -> &mut Self { assert!( max >= proto::h1::MINIMUM_MAX_BUFFER_SIZE, "the max_buf_size cannot be smaller than the minimum that h1 specifies." diff --git a/src/ext.rs b/src/ext.rs index 224206dd66..a87b115576 100644 --- a/src/ext.rs +++ b/src/ext.rs @@ -76,7 +76,7 @@ impl fmt::Debug for Protocol { /// A map from header names to their original casing as received in an HTTP message. /// /// If an HTTP/1 response `res` is parsed on a connection whose option -/// [`http1_preserve_header_case`] was set to true and the response included +/// [`preserve_header_case`] was set to true and the response included /// the following headers: /// /// ```ignore @@ -93,7 +93,7 @@ impl fmt::Debug for Protocol { /// }) /// ``` /// -/// [`http1_preserve_header_case`]: /client/struct.Client.html#method.http1_preserve_header_case +/// [`preserve_header_case`]: /client/struct.Client.html#method.preserve_header_case #[derive(Clone, Debug)] pub(crate) struct HeaderCaseMap(HeaderMap); diff --git a/tests/client.rs b/tests/client.rs index ab50f07cbf..e01d49fbe9 100644 --- a/tests/client.rs +++ b/tests/client.rs @@ -1197,7 +1197,7 @@ test! { client: options: { - http1_title_case_headers: true, + title_case_headers: true, }, request: { method: GET, @@ -1311,7 +1311,7 @@ test! { client: options: { - http1_allow_obsolete_multiline_headers_in_responses: true, + allow_obsolete_multiline_headers_in_responses: true, }, request: { method: GET,