mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Basic certificate verification (fixes #4119)
This commit is contained in:
parent
816a3c2d91
commit
dfd746b38d
6 changed files with 17 additions and 2 deletions
|
@ -23,6 +23,9 @@ git = "https://github.com/servo/rust-png"
|
||||||
[dependencies.stb_image]
|
[dependencies.stb_image]
|
||||||
git = "https://github.com/servo/rust-stb-image"
|
git = "https://github.com/servo/rust-stb-image"
|
||||||
|
|
||||||
|
[dependencies.openssl]
|
||||||
|
git = "https://github.com/sfackler/rust-openssl"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
url = "0.2.16"
|
url = "0.2.16"
|
||||||
time = "0.1.12"
|
time = "0.1.12"
|
||||||
|
|
|
@ -10,8 +10,10 @@ use std::collections::HashSet;
|
||||||
use hyper::client::Request;
|
use hyper::client::Request;
|
||||||
use hyper::header::common::{ContentLength, ContentType, Host, Location};
|
use hyper::header::common::{ContentLength, ContentType, Host, Location};
|
||||||
use hyper::method::Method;
|
use hyper::method::Method;
|
||||||
|
use hyper::net::HttpConnector;
|
||||||
use hyper::status::StatusClass;
|
use hyper::status::StatusClass;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
use openssl::ssl::{SslContext, SslVerifyMode};
|
||||||
use std::io::Reader;
|
use std::io::Reader;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::mpsc::Sender;
|
||||||
use util::task::spawn_named;
|
use util::task::spawn_named;
|
||||||
|
@ -63,6 +65,7 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
||||||
|
|
||||||
redirected_to.insert(url.clone());
|
redirected_to.insert(url.clone());
|
||||||
|
|
||||||
|
|
||||||
match url.scheme.as_slice() {
|
match url.scheme.as_slice() {
|
||||||
"http" | "https" => {}
|
"http" | "https" => {}
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -74,7 +77,12 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
||||||
|
|
||||||
info!("requesting {}", url.serialize());
|
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,
|
Ok(req) => req,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
send_error(url, e.description().to_string(), senders);
|
send_error(url, e.description().to_string(), senders);
|
||||||
|
|
|
@ -17,6 +17,7 @@ extern crate hyper;
|
||||||
extern crate png;
|
extern crate png;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
extern crate openssl;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate util;
|
extern crate util;
|
||||||
extern crate stb_image;
|
extern crate stb_image;
|
||||||
|
|
1
components/servo/Cargo.lock
generated
1
components/servo/Cargo.lock
generated
|
@ -589,6 +589,7 @@ version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||||
"hyper 0.1.0 (git+https://github.com/servo/hyper?branch=servo)",
|
"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)",
|
"png 0.1.0 (git+https://github.com/servo/rust-png)",
|
||||||
"stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)",
|
"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)",
|
"time 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
1
ports/cef/Cargo.lock
generated
1
ports/cef/Cargo.lock
generated
|
@ -552,6 +552,7 @@ version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||||
"hyper 0.1.0 (git+https://github.com/servo/hyper?branch=servo)",
|
"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)",
|
"png 0.1.0 (git+https://github.com/servo/rust-png)",
|
||||||
"stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)",
|
"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)",
|
"time 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
1
ports/gonk/Cargo.lock
generated
1
ports/gonk/Cargo.lock
generated
|
@ -471,6 +471,7 @@ version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||||
"hyper 0.1.0 (git+https://github.com/servo/hyper?branch=servo)",
|
"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)",
|
"png 0.1.0 (git+https://github.com/servo/rust-png)",
|
||||||
"stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image)",
|
"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)",
|
"time 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue