diff --git a/components/net/Cargo.toml b/components/net/Cargo.toml index dcc04439966..532f0613b53 100644 --- a/components/net/Cargo.toml +++ b/components/net/Cargo.toml @@ -23,6 +23,9 @@ git = "https://github.com/servo/rust-png" [dependencies.stb_image] git = "https://github.com/servo/rust-stb-image" +[dependencies.openssl] +git = "https://github.com/sfackler/rust-openssl" + [dependencies] url = "0.2.16" -time = "0.1.12" \ No newline at end of file +time = "0.1.12" diff --git a/components/net/http_loader.rs b/components/net/http_loader.rs index c5ef9e29899..ca6a252fc4d 100644 --- a/components/net/http_loader.rs +++ b/components/net/http_loader.rs @@ -10,8 +10,10 @@ use std::collections::HashSet; use hyper::client::Request; use hyper::header::common::{ContentLength, ContentType, Host, Location}; use hyper::method::Method; +use hyper::net::HttpConnector; use hyper::status::StatusClass; use std::error::Error; +use openssl::ssl::{SslContext, SslVerifyMode}; use std::io::Reader; use std::sync::mpsc::Sender; use util::task::spawn_named; @@ -63,6 +65,7 @@ fn load(load_data: LoadData, start_chan: Sender) { redirected_to.insert(url.clone()); + match url.scheme.as_slice() { "http" | "https" => {} _ => { @@ -74,7 +77,12 @@ fn load(load_data: LoadData, start_chan: Sender) { info!("requesting {}", url.serialize()); - let mut req = match Request::new(load_data.method.clone(), url.clone()) { + fn verifier<'a>(ssl: &mut SslContext) { + ssl.set_verify(SslVerifyMode::SslVerifyPeer, None); + ssl.set_CA_file(&Path::new("/home/manishearth/sand/equifax")); + } + + let mut req = match Request::with_connector(load_data.method.clone(), url.clone(), &mut HttpConnector(Some(verifier))) { Ok(req) => req, Err(e) => { send_error(url, e.description().to_string(), senders); diff --git a/components/net/lib.rs b/components/net/lib.rs index c3c6047d0df..130df50aa4d 100644 --- a/components/net/lib.rs +++ b/components/net/lib.rs @@ -17,6 +17,7 @@ extern crate hyper; extern crate png; #[macro_use] extern crate log; +extern crate openssl; extern crate serialize; extern crate util; extern crate stb_image; diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 0a73371f772..3329848c36a 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -589,6 +589,7 @@ version = "0.0.1" dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "hyper 0.1.0 (git+https://github.com/servo/hyper?branch=servo)", + "openssl 0.2.4 (git+https://github.com/sfackler/rust-openssl)", "png 0.1.0 (git+https://github.com/servo/rust-png)", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", "time 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 92050b0ff10..c18a7e36d23 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -552,6 +552,7 @@ version = "0.0.1" dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "hyper 0.1.0 (git+https://github.com/servo/hyper?branch=servo)", + "openssl 0.2.4 (git+https://github.com/sfackler/rust-openssl)", "png 0.1.0 (git+https://github.com/servo/rust-png)", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", "time 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index cb757621237..b08ca889877 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -471,6 +471,7 @@ version = "0.0.1" dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "hyper 0.1.0 (git+https://github.com/servo/hyper?branch=servo)", + "openssl 0.2.4 (git+https://github.com/sfackler/rust-openssl)", "png 0.1.0 (git+https://github.com/servo/rust-png)", "stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)", "time 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",