feat(client): allow HTTP/0.9 responses behind a flag (#2473)
Fixes #2468
This commit is contained in:
@@ -47,6 +47,7 @@ where
|
||||
#[cfg(feature = "ffi")]
|
||||
preserve_header_case: false,
|
||||
title_case_headers: false,
|
||||
h09_responses: false,
|
||||
notify_read: false,
|
||||
reading: Reading::Init,
|
||||
writing: Writing::Init,
|
||||
@@ -78,6 +79,11 @@ where
|
||||
self.state.title_case_headers = true;
|
||||
}
|
||||
|
||||
#[cfg(feature = "client")]
|
||||
pub(crate) fn set_h09_responses(&mut self) {
|
||||
self.state.h09_responses = true;
|
||||
}
|
||||
|
||||
#[cfg(feature = "server")]
|
||||
pub(crate) fn set_allow_half_close(&mut self) {
|
||||
self.state.allow_half_close = true;
|
||||
@@ -146,6 +152,7 @@ where
|
||||
req_method: &mut self.state.method,
|
||||
#[cfg(feature = "ffi")]
|
||||
preserve_header_case: self.state.preserve_header_case,
|
||||
h09_responses: self.state.h09_responses,
|
||||
}
|
||||
)) {
|
||||
Ok(msg) => msg,
|
||||
@@ -157,6 +164,9 @@ where
|
||||
|
||||
debug!("incoming body is {}", msg.decode);
|
||||
|
||||
// Prevent accepting HTTP/0.9 responses after the initial one, if any.
|
||||
self.state.h09_responses = false;
|
||||
|
||||
self.state.busy();
|
||||
self.state.keep_alive &= msg.keep_alive;
|
||||
self.state.version = msg.head.version;
|
||||
@@ -753,6 +763,7 @@ struct State {
|
||||
#[cfg(feature = "ffi")]
|
||||
preserve_header_case: bool,
|
||||
title_case_headers: bool,
|
||||
h09_responses: bool,
|
||||
/// Set to true when the Dispatcher should poll read operations
|
||||
/// again. See the `maybe_notify` method for more.
|
||||
notify_read: bool,
|
||||
|
||||
Reference in New Issue
Block a user