mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Add xpcshell script and warning
This commit is contained in:
parent
dfd746b38d
commit
524331d232
10 changed files with 8260 additions and 56 deletions
|
@ -23,9 +23,7 @@ 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"
|
||||
openssl="*"
|
|
@ -7,16 +7,19 @@ use resource_task::ProgressMsg::{Payload, Done};
|
|||
|
||||
use log;
|
||||
use std::collections::HashSet;
|
||||
use file_loader;
|
||||
use hyper::client::Request;
|
||||
use hyper::header::common::{ContentLength, ContentType, Host, Location};
|
||||
use hyper::HttpError;
|
||||
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::io::{IoError, IoErrorKind, Reader};
|
||||
use std::sync::mpsc::Sender;
|
||||
use util::task::spawn_named;
|
||||
use util::resource_files::resources_dir_path;
|
||||
use url::{Url, UrlParser};
|
||||
|
||||
use std::borrow::ToOwned;
|
||||
|
@ -77,14 +80,29 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
|||
|
||||
info!("requesting {}", url.serialize());
|
||||
|
||||
fn verifier<'a>(ssl: &mut SslContext) {
|
||||
fn verifier(ssl: &mut SslContext) {
|
||||
ssl.set_verify(SslVerifyMode::SslVerifyPeer, None);
|
||||
ssl.set_CA_file(&Path::new("/home/manishearth/sand/equifax"));
|
||||
}
|
||||
let mut certs = resources_dir_path();
|
||||
certs.push("certs");
|
||||
ssl.set_CA_file(&certs);
|
||||
};
|
||||
|
||||
let mut req = match Request::with_connector(load_data.method.clone(), url.clone(), &mut HttpConnector(Some(verifier))) {
|
||||
let ssl_err_string = "[UnknownError { library: \"SSL routines\", function: \"SSL3_GET_SERVER_CERTIFICATE\",\
|
||||
reason: \"certificate verify failed\" }]";
|
||||
let mut req = match Request::with_connector(load_data.method.clone(), url.clone(),
|
||||
&mut HttpConnector(Some(box verifier as Box<FnMut(&mut SslContext)>))) {
|
||||
Ok(req) => req,
|
||||
Err(HttpError::HttpIoError(IoError {kind: IoErrorKind::OtherIoError,
|
||||
desc: "Error in OpenSSL",
|
||||
detail: Some(ref det)})) if det.as_slice() == ssl_err_string => {
|
||||
let mut image = resources_dir_path();
|
||||
image.push("badcert.html");
|
||||
let load_data = LoadData::new(Url::from_file_path(&image).unwrap(), senders.eventual_consumer);
|
||||
file_loader::factory(load_data, senders.immediate_consumer);
|
||||
return;
|
||||
},
|
||||
Err(e) => {
|
||||
println!("{:?}", e);
|
||||
send_error(url, e.description().to_string(), senders);
|
||||
return;
|
||||
}
|
||||
|
|
12
components/servo/Cargo.lock
generated
12
components/servo/Cargo.lock
generated
|
@ -427,8 +427,8 @@ source = "git+https://github.com/servo/html5ever#d35dfaaf0d85007057a299afc370d07
|
|||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/hyper?branch=servo#248a6f29086baa841eb30c88540dca3196accae4"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/servo/hyper?branch=servo#7f48a7e945180a4f762dc75236210d20a69b4a6a"
|
||||
dependencies = [
|
||||
"cookie 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -570,7 +570,7 @@ dependencies = [
|
|||
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
|
||||
"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.1 (git+https://github.com/servo/hyper?branch=servo)",
|
||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
|
||||
"style 0.0.1",
|
||||
|
@ -588,8 +588,8 @@ name = "net"
|
|||
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)",
|
||||
"hyper 0.1.1 (git+https://github.com/servo/hyper?branch=servo)",
|
||||
"openssl 0.2.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"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)",
|
||||
|
@ -684,7 +684,7 @@ dependencies = [
|
|||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||
"gfx 0.0.1",
|
||||
"html5ever 0.0.0 (git+https://github.com/servo/html5ever)",
|
||||
"hyper 0.1.0 (git+https://github.com/servo/hyper?branch=servo)",
|
||||
"hyper 0.1.1 (git+https://github.com/servo/hyper?branch=servo)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue