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:
		
							
								
								
									
										11
									
								
								src/net.rs
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								src/net.rs
									
									
									
									
									
								
							| @@ -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. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user