mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Return a network error Response from http_network_fetch when obtain_response fails.
This commit is contained in:
parent
784c45a306
commit
a66f186866
1 changed files with 9 additions and 4 deletions
|
@ -28,8 +28,7 @@ use net_traits::{FetchTaskTarget, FetchMetadata, NetworkError};
|
|||
use net_traits::request::{CacheMode, CredentialsMode, Destination};
|
||||
use net_traits::request::{RedirectMode, Referrer, Request, RequestMode, ResponseTainting};
|
||||
use net_traits::request::{Type, Origin, Window};
|
||||
use net_traits::response::{HttpsState, TerminationReason};
|
||||
use net_traits::response::{Response, ResponseBody, ResponseType};
|
||||
use net_traits::response::{HttpsState, Response, ResponseBody, ResponseType};
|
||||
use resource_thread::CancellationListener;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashSet;
|
||||
|
@ -1099,8 +1098,14 @@ fn http_network_fetch(request: Rc<Request>,
|
|||
}
|
||||
});
|
||||
},
|
||||
Err(_) => {
|
||||
response.termination_reason = Some(TerminationReason::Fatal);
|
||||
Err(error) => {
|
||||
let error = match error.error {
|
||||
LoadErrorType::ConnectionAborted { .. } => unreachable!(),
|
||||
LoadErrorType::Ssl { reason } => NetworkError::SslValidation(error.url, reason),
|
||||
LoadErrorType::Cancelled => NetworkError::LoadCancelled,
|
||||
e => NetworkError::Internal(e.description().to_owned())
|
||||
};
|
||||
return Response::network_error(error);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue