fix(client): be resilient to invalid response bodies

When an Http11Message knows that the previous response should not
have included a body per RFC7230, and fails to parse the following
response, the bytes are shuffled along, checking for the start of the
next response.

Closes #640
This commit is contained in:
Sean McArthur
2015-09-01 16:44:58 -07:00
parent 5c7195ab4a
commit 75c7117020
6 changed files with 186 additions and 60 deletions

View File

@@ -62,6 +62,17 @@ pub trait NetworkStream: Read + Write + Any + Send + Typeable {
fn close(&mut self, _how: Shutdown) -> io::Result<()> {
Ok(())
}
// Unsure about name and implementation...
#[doc(hidden)]
fn set_previous_response_expected_no_content(&mut self, _expected: bool) {
}
#[doc(hidden)]
fn previous_response_expected_no_content(&self) -> bool {
false
}
}
/// A connector creates a NetworkStream.