mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
net: Pass certs that fail the SSL handshake out of the network layer.
This commit is contained in:
parent
1cdaf40eb2
commit
0ce2aa917a
7 changed files with 136 additions and 44 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue