Check for synthetic_error early in unit::connect
This commit is contained in:
1 parent
bd2761e280
commit
67c28d28a3
2 files changed
+8
No files matched your search
@@ -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