Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UI for bypassing SSL handshake failures #26716

Merged
merged 7 commits into from Jun 10, 2020
Next

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

  • Loading branch information
jdm committed Jun 9, 2020
commit b7a640b5172ebcdea73179c5a33486930ef35e96
@@ -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 {
@@ -731,9 +731,9 @@ impl FetchResponseListener for ParserContext {
FetchMetadata::Unfiltered(m) => m,
FetchMetadata::Filtered { unsafe_, .. } => unsafe_,
}),
Err(NetworkError::SslValidation(url, reason)) => {
Err(NetworkError::SslValidation(reason)) => {
ssl_error = Some(reason);
let mut meta = Metadata::default(url);
let mut meta = Metadata::default(self.url.clone());
let mime: Option<Mime> = "text/html".parse().ok();
meta.set_content_type(mime.as_ref());
Some(meta)
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.