net: Pass certs that fail the SSL handshake out of the network layer.

This commit is contained in:
Josh Matthews 2020-05-29 11:56:17 -04:00
parent 1cdaf40eb2
commit 0ce2aa917a
7 changed files with 136 additions and 44 deletions

View file

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