Skip to content

Commit 4cbaef7

Browse files
Michael-J-Wardseanmonstar
authored andcommittedDec 28, 2022
feat(client): remove http1_ prefixes from client::conn::http1::Builder methods
Refs: #3085
1 parent 984760f commit 4cbaef7

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed
 

‎examples/http_proxy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ async fn proxy(
9090
let stream = TcpStream::connect(addr).await.unwrap();
9191

9292
let (mut sender, conn) = Builder::new()
93-
.http1_preserve_header_case(true)
94-
.http1_title_case_headers(true)
93+
.preserve_header_case(true)
94+
.title_case_headers(true)
9595
.handshake(stream)
9696
.await?;
9797
tokio::task::spawn(async move {

‎src/client/conn/http1.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ impl Builder {
338338
/// Default is false.
339339
///
340340
/// [RFC 7230 Section 3.2.4.]: https://tools.ietf.org/html/rfc7230#section-3.2.4
341-
pub fn http1_allow_spaces_after_header_name_in_responses(
341+
pub fn allow_spaces_after_header_name_in_responses(
342342
&mut self,
343343
enabled: bool,
344344
) -> &mut Builder {
@@ -381,7 +381,7 @@ impl Builder {
381381
/// Default is false.
382382
///
383383
/// [RFC 7230 Section 3.2.4.]: https://tools.ietf.org/html/rfc7230#section-3.2.4
384-
pub fn http1_allow_obsolete_multiline_headers_in_responses(
384+
pub fn allow_obsolete_multiline_headers_in_responses(
385385
&mut self,
386386
enabled: bool,
387387
) -> &mut Builder {
@@ -399,7 +399,7 @@ impl Builder {
399399
/// Note that this setting does not affect HTTP/2.
400400
///
401401
/// Default is false.
402-
pub fn http1_ignore_invalid_headers_in_responses(&mut self, enabled: bool) -> &mut Builder {
402+
pub fn ignore_invalid_headers_in_responses(&mut self, enabled: bool) -> &mut Builder {
403403
self.h1_parser_config
404404
.ignore_invalid_headers_in_responses(enabled);
405405
self
@@ -417,7 +417,7 @@ impl Builder {
417417
///
418418
/// Default is `auto`. In this mode hyper will try to guess which
419419
/// mode to use
420-
pub fn http1_writev(&mut self, enabled: bool) -> &mut Builder {
420+
pub fn writev(&mut self, enabled: bool) -> &mut Builder {
421421
self.h1_writev = Some(enabled);
422422
self
423423
}
@@ -428,7 +428,7 @@ impl Builder {
428428
/// Note that this setting does not affect HTTP/2.
429429
///
430430
/// Default is false.
431-
pub fn http1_title_case_headers(&mut self, enabled: bool) -> &mut Builder {
431+
pub fn title_case_headers(&mut self, enabled: bool) -> &mut Builder {
432432
self.h1_title_case_headers = enabled;
433433
self
434434
}
@@ -446,7 +446,7 @@ impl Builder {
446446
/// Note that this setting does not affect HTTP/2.
447447
///
448448
/// Default is false.
449-
pub fn http1_preserve_header_case(&mut self, enabled: bool) -> &mut Builder {
449+
pub fn preserve_header_case(&mut self, enabled: bool) -> &mut Builder {
450450
self.h1_preserve_header_case = enabled;
451451
self
452452
}
@@ -461,17 +461,17 @@ impl Builder {
461461
///
462462
/// Default is false.
463463
#[cfg(feature = "ffi")]
464-
pub fn http1_preserve_header_order(&mut self, enabled: bool) -> &mut Builder {
464+
pub fn preserve_header_order(&mut self, enabled: bool) -> &mut Builder {
465465
self.h1_preserve_header_order = enabled;
466466
self
467467
}
468468

469469
/// Sets the exact size of the read buffer to *always* use.
470470
///
471-
/// Note that setting this option unsets the `http1_max_buf_size` option.
471+
/// Note that setting this option unsets the `max_buf_size` option.
472472
///
473473
/// Default is an adaptive read buffer.
474-
pub fn http1_read_buf_exact_size(&mut self, sz: Option<usize>) -> &mut Builder {
474+
pub fn read_buf_exact_size(&mut self, sz: Option<usize>) -> &mut Builder {
475475
self.h1_read_buf_exact_size = sz;
476476
self.h1_max_buf_size = None;
477477
self
@@ -481,12 +481,12 @@ impl Builder {
481481
///
482482
/// Default is ~400kb.
483483
///
484-
/// Note that setting this option unsets the `http1_read_exact_buf_size` option.
484+
/// Note that setting this option unsets the `read_exact_buf_size` option.
485485
///
486486
/// # Panics
487487
///
488488
/// The minimum value allowed is 8192. This method panics if the passed `max` is less than the minimum.
489-
pub fn http1_max_buf_size(&mut self, max: usize) -> &mut Self {
489+
pub fn max_buf_size(&mut self, max: usize) -> &mut Self {
490490
assert!(
491491
max >= proto::h1::MINIMUM_MAX_BUFFER_SIZE,
492492
"the max_buf_size cannot be smaller than the minimum that h1 specifies."

‎src/ext.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl fmt::Debug for Protocol {
7676
/// A map from header names to their original casing as received in an HTTP message.
7777
///
7878
/// If an HTTP/1 response `res` is parsed on a connection whose option
79-
/// [`http1_preserve_header_case`] was set to true and the response included
79+
/// [`preserve_header_case`] was set to true and the response included
8080
/// the following headers:
8181
///
8282
/// ```ignore
@@ -93,7 +93,7 @@ impl fmt::Debug for Protocol {
9393
/// })
9494
/// ```
9595
///
96-
/// [`http1_preserve_header_case`]: /client/struct.Client.html#method.http1_preserve_header_case
96+
/// [`preserve_header_case`]: /client/struct.Client.html#method.preserve_header_case
9797
#[derive(Clone, Debug)]
9898
pub(crate) struct HeaderCaseMap(HeaderMap<Bytes>);
9999

‎src/ffi/client.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ ffi_fn! {
7070

7171
conn::http1::Builder::new()
7272
.executor(options.exec.clone())
73-
.http1_allow_obsolete_multiline_headers_in_responses(options.http1_allow_obsolete_multiline_headers_in_responses)
74-
.http1_preserve_header_case(options.http1_preserve_header_case)
75-
.http1_preserve_header_order(options.http1_preserve_header_order)
73+
.allow_obsolete_multiline_headers_in_responses(options.http1_allow_obsolete_multiline_headers_in_responses)
74+
.preserve_header_case(options.http1_preserve_header_case)
75+
.preserve_header_order(options.http1_preserve_header_order)
7676
.handshake::<_, crate::body::Incoming>(io)
7777
.await
7878
.map(|(tx, conn)| {

‎tests/client.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ test! {
11971197

11981198
client:
11991199
options: {
1200-
http1_title_case_headers: true,
1200+
title_case_headers: true,
12011201
},
12021202
request: {
12031203
method: GET,
@@ -1311,7 +1311,7 @@ test! {
13111311

13121312
client:
13131313
options: {
1314-
http1_allow_obsolete_multiline_headers_in_responses: true,
1314+
allow_obsolete_multiline_headers_in_responses: true,
13151315
},
13161316
request: {
13171317
method: GET,

0 commit comments

Comments
 (0)
Please sign in to comment.