Skip to content

Commit

Permalink
feat(client): remove http1_ prefixes from `client::conn::http1::Build…
Browse files Browse the repository at this point in the history
…er` methods

Refs: #3085
  • Loading branch information
Michael-J-Ward authored and seanmonstar committed Dec 28, 2022
1 parent 984760f commit 4cbaef7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions examples/http_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
22 changes: 11 additions & 11 deletions src/client/conn/http1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}
Expand All @@ -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<usize>) -> &mut Builder {
pub fn read_buf_exact_size(&mut self, sz: Option<usize>) -> &mut Builder {
self.h1_read_buf_exact_size = sz;
self.h1_max_buf_size = None;
self
Expand All @@ -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."
Expand Down
4 changes: 2 additions & 2 deletions src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<Bytes>);

Expand Down
6 changes: 3 additions & 3 deletions src/ffi/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ ffi_fn! {

conn::http1::Builder::new()
.executor(options.exec.clone())
.http1_allow_obsolete_multiline_headers_in_responses(options.http1_allow_obsolete_multiline_headers_in_responses)
.http1_preserve_header_case(options.http1_preserve_header_case)
.http1_preserve_header_order(options.http1_preserve_header_order)
.allow_obsolete_multiline_headers_in_responses(options.http1_allow_obsolete_multiline_headers_in_responses)
.preserve_header_case(options.http1_preserve_header_case)
.preserve_header_order(options.http1_preserve_header_order)
.handshake::<_, crate::body::Incoming>(io)
.await
.map(|(tx, conn)| {
Expand Down
4 changes: 2 additions & 2 deletions tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ test! {

client:
options: {
http1_title_case_headers: true,
title_case_headers: true,
},
request: {
method: GET,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4cbaef7

Please sign in to comment.