feat(client): allow HTTP/0.9 responses behind a flag (#2473)

Fixes #2468
This commit is contained in:
Anthony Ramine
2021-03-26 19:25:00 +01:00
committed by GitHub
parent 51ed71b0a6
commit 68d4e4a3db
8 changed files with 158 additions and 4 deletions

View File

@@ -122,6 +122,7 @@ where
#[derive(Clone, Debug)]
pub struct Builder {
pub(super) exec: Exec,
h09_responses: bool,
h1_title_case_headers: bool,
h1_read_buf_exact_size: Option<usize>,
h1_max_buf_size: Option<usize>,
@@ -493,6 +494,7 @@ impl Builder {
pub fn new() -> Builder {
Builder {
exec: Exec::Default,
h09_responses: false,
h1_read_buf_exact_size: None,
h1_title_case_headers: false,
h1_max_buf_size: None,
@@ -514,6 +516,11 @@ impl Builder {
self
}
pub(super) fn h09_responses(&mut self, enabled: bool) -> &mut Builder {
self.h09_responses = enabled;
self
}
pub(super) fn h1_title_case_headers(&mut self, enabled: bool) -> &mut Builder {
self.h1_title_case_headers = enabled;
self
@@ -700,6 +707,9 @@ impl Builder {
if opts.h1_title_case_headers {
conn.set_title_case_headers();
}
if opts.h09_responses {
conn.set_h09_responses();
}
if let Some(sz) = opts.h1_read_buf_exact_size {
conn.set_read_buf_exact_size(sz);
}