net: Treat SSL handshake errors differently from other hyper errors.

This commit is contained in:
Josh Matthews 2020-05-27 19:22:46 -04:00
parent cb4e3cb16a
commit b7a640b517
2 changed files with 9 additions and 4 deletions

View file

@ -712,12 +712,17 @@ pub enum NetworkError {
Internal(String),
LoadCancelled,
/// SSL validation error that has to be handled in the HTML parser
SslValidation(ServoUrl, String),
SslValidation(String),
}
impl NetworkError {
pub fn from_hyper_error(error: &HyperError) -> Self {
NetworkError::Internal(error.to_string())
let s = error.to_string();
if s.contains("the handshake failed") {
NetworkError::SslValidation(s)
} else {
NetworkError::Internal(s)
}
}
pub fn from_http_error(error: &HttpError) -> Self {