feat(client): allow HTTP/0.9 responses behind a flag (#2473)
Fixes #2468
This commit is contained in:
		| @@ -972,6 +972,14 @@ impl Builder { | ||||
|         self | ||||
|     } | ||||
|  | ||||
|     /// Set whether HTTP/0.9 responses should be tolerated. | ||||
|     /// | ||||
|     /// Default is false. | ||||
|     pub fn http09_responses(&mut self, val: bool) -> &mut Self { | ||||
|         self.conn_builder.h09_responses(val); | ||||
|         self | ||||
|     } | ||||
|  | ||||
|     /// Set whether the connection **must** use HTTP/2. | ||||
|     /// | ||||
|     /// The destination must either allow HTTP2 Prior Knowledge, or the | ||||
|   | ||||
| @@ -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); | ||||
|                     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user