Check for synthetic_error early in unit::connect
This commit is contained in:
committed by
Martin Algesten
parent
bd2761e280
commit
67c28d28a3
@@ -221,6 +221,11 @@ impl Response {
|
||||
&self.error
|
||||
}
|
||||
|
||||
// Internal-only API, to allow unit::connect to return early on errors.
|
||||
pub(crate) fn into_error(self) -> Option<Error> {
|
||||
self.error
|
||||
}
|
||||
|
||||
/// The content type part of the "Content-Type" header without
|
||||
/// the charset.
|
||||
///
|
||||
|
||||
@@ -181,6 +181,9 @@ pub(crate) fn connect(
|
||||
// start reading the response to process cookies and redirects.
|
||||
let mut stream = stream::DeadlineStream::new(stream, unit.deadline);
|
||||
let mut resp = Response::from_read(&mut stream);
|
||||
if resp.synthetic_error().is_some() {
|
||||
return Err(resp.into_error().unwrap());
|
||||
}
|
||||
|
||||
// https://tools.ietf.org/html/rfc7230#section-6.3.1
|
||||
// When an inbound connection is closed prematurely, a client MAY
|
||||
|
||||
Reference in New Issue
Block a user