mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
auto merge of #4198 : Manishearth/servo/hyper-droid, r=Manishearth
This is the Hyper pull request, plus the set up for OpenSSL on Android to make it merge. Sean's commits have been reviewed in #4065 (My Android changes were reviewed by Glenn)
This commit is contained in:
commit
6bd9bf979b
38 changed files with 927 additions and 477 deletions
|
@ -1 +1 @@
|
||||||
2014-11-06
|
2014-12-02
|
||||||
|
|
|
@ -17,8 +17,8 @@ git = "https://github.com/servo/rust-azure"
|
||||||
[dependencies.geom]
|
[dependencies.geom]
|
||||||
git = "https://github.com/servo/rust-geom"
|
git = "https://github.com/servo/rust-geom"
|
||||||
|
|
||||||
[dependencies.http]
|
[dependencies.hyper]
|
||||||
git = "https://github.com/servo/rust-http"
|
git = "https://github.com/servo/hyper"
|
||||||
branch = "servo"
|
branch = "servo"
|
||||||
|
|
||||||
[dependencies.layers]
|
[dependencies.layers]
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
use geom::rect::Rect;
|
use geom::rect::Rect;
|
||||||
use geom::size::TypedSize2D;
|
use geom::size::TypedSize2D;
|
||||||
use geom::scale_factor::ScaleFactor;
|
use geom::scale_factor::ScaleFactor;
|
||||||
use http::headers::request::HeaderCollection as RequestHeaderCollection;
|
use hyper::header::Headers;
|
||||||
use http::method::{Method, Get};
|
use hyper::method::{Method, Get};
|
||||||
use layers::geometry::DevicePixel;
|
use layers::geometry::DevicePixel;
|
||||||
use servo_util::geometry::{PagePx, ViewportPx};
|
use servo_util::geometry::{PagePx, ViewportPx};
|
||||||
use std::comm::{channel, Sender, Receiver};
|
use std::comm::{channel, Sender, Receiver};
|
||||||
|
@ -214,7 +214,7 @@ pub enum Msg {
|
||||||
pub struct LoadData {
|
pub struct LoadData {
|
||||||
pub url: Url,
|
pub url: Url,
|
||||||
pub method: Method,
|
pub method: Method,
|
||||||
pub headers: RequestHeaderCollection,
|
pub headers: Headers,
|
||||||
pub data: Option<Vec<u8>>,
|
pub data: Option<Vec<u8>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ impl LoadData {
|
||||||
LoadData {
|
LoadData {
|
||||||
url: url,
|
url: url,
|
||||||
method: Get,
|
method: Get,
|
||||||
headers: RequestHeaderCollection::new(),
|
headers: Headers::new(),
|
||||||
data: None,
|
data: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
extern crate azure;
|
extern crate azure;
|
||||||
extern crate geom;
|
extern crate geom;
|
||||||
extern crate http;
|
extern crate hyper;
|
||||||
extern crate layers;
|
extern crate layers;
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
extern crate "util" as servo_util;
|
extern crate "util" as servo_util;
|
||||||
|
|
|
@ -13,8 +13,8 @@ path = "../util"
|
||||||
[dependencies.geom]
|
[dependencies.geom]
|
||||||
git = "https://github.com/servo/rust-geom"
|
git = "https://github.com/servo/rust-geom"
|
||||||
|
|
||||||
[dependencies.http]
|
[dependencies.hyper]
|
||||||
git = "https://github.com/servo/rust-http"
|
git = "https://github.com/servo/hyper"
|
||||||
branch = "servo"
|
branch = "servo"
|
||||||
|
|
||||||
[dependencies.png]
|
[dependencies.png]
|
||||||
|
|
|
@ -7,7 +7,7 @@ use file_loader;
|
||||||
|
|
||||||
use std::io::fs::PathExtensions;
|
use std::io::fs::PathExtensions;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use http::status::Ok as StatusOk;
|
use hyper::http::RawStatus;
|
||||||
use servo_util::resource_files::resources_dir_path;
|
use servo_util::resource_files::resources_dir_path;
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ pub fn factory(mut load_data: LoadData, start_chan: Sender<TargetedLoadResponse>
|
||||||
content_type: Some(("text".to_string(), "html".to_string())),
|
content_type: Some(("text".to_string(), "html".to_string())),
|
||||||
charset: Some("utf-8".to_string()),
|
charset: Some("utf-8".to_string()),
|
||||||
headers: None,
|
headers: None,
|
||||||
status: Some(StatusOk),
|
status: Some(RawStatus(200, "OK".into_string()))
|
||||||
});
|
});
|
||||||
chan.send(Done(Ok(())));
|
chan.send(Done(Ok(())));
|
||||||
return
|
return
|
||||||
|
|
|
@ -6,8 +6,7 @@ use resource_task::{Done, Payload, Metadata, LoadData, TargetedLoadResponse, sta
|
||||||
|
|
||||||
use serialize::base64::FromBase64;
|
use serialize::base64::FromBase64;
|
||||||
|
|
||||||
use http::headers::test_utils::from_stream_with_str;
|
use hyper::mime::Mime;
|
||||||
use http::headers::content_type::MediaType;
|
|
||||||
use url::{percent_decode, NonRelativeSchemeData};
|
use url::{percent_decode, NonRelativeSchemeData};
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,8 +58,8 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
||||||
|
|
||||||
// Parse the content type using rust-http.
|
// Parse the content type using rust-http.
|
||||||
// FIXME: this can go into an infinite loop! (rust-http #25)
|
// FIXME: this can go into an infinite loop! (rust-http #25)
|
||||||
let content_type: Option<MediaType> = from_stream_with_str(ct_str);
|
let content_type: Option<Mime> = from_str(ct_str);
|
||||||
metadata.set_content_type(&content_type);
|
metadata.set_content_type(content_type.as_ref());
|
||||||
|
|
||||||
let progress_chan = start_sending(senders, metadata);
|
let progress_chan = start_sending(senders, metadata);
|
||||||
let bytes = percent_decode(parts[1].as_bytes());
|
let bytes = percent_decode(parts[1].as_bytes());
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
//! This library will eventually become the core of the Fetch crate
|
//! This library will eventually become the core of the Fetch crate
|
||||||
//! with CORSRequest being expanded into FetchRequest (etc)
|
//! with CORSRequest being expanded into FetchRequest (etc)
|
||||||
|
|
||||||
use http::method::Method;
|
use hyper::method::Method;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::comm::{Sender, Receiver, channel};
|
use std::comm::{Sender, Receiver, channel};
|
||||||
use time;
|
use time;
|
||||||
|
|
|
@ -3,8 +3,10 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use http::method::{Get, Method};
|
use hyper::method::{Get, Method};
|
||||||
use http::headers::request::HeaderCollection;
|
use hyper::mime::{Mime, Text, Html, Charset, Utf8};
|
||||||
|
use hyper::header::Headers;
|
||||||
|
use hyper::header::common::ContentType;
|
||||||
use fetch::cors_cache::CORSCache;
|
use fetch::cors_cache::CORSCache;
|
||||||
use fetch::response::Response;
|
use fetch::response::Response;
|
||||||
|
|
||||||
|
@ -58,7 +60,7 @@ pub enum ResponseTainting {
|
||||||
pub struct Request {
|
pub struct Request {
|
||||||
pub method: Method,
|
pub method: Method,
|
||||||
pub url: Url,
|
pub url: Url,
|
||||||
pub headers: HeaderCollection,
|
pub headers: Headers,
|
||||||
pub unsafe_request: bool,
|
pub unsafe_request: bool,
|
||||||
pub body: Option<Vec<u8>>,
|
pub body: Option<Vec<u8>>,
|
||||||
pub preserve_content_codings: bool,
|
pub preserve_content_codings: bool,
|
||||||
|
@ -87,7 +89,7 @@ impl Request {
|
||||||
Request {
|
Request {
|
||||||
method: Get,
|
method: Get,
|
||||||
url: url,
|
url: url,
|
||||||
headers: HeaderCollection::new(),
|
headers: Headers::new(),
|
||||||
unsafe_request: false,
|
unsafe_request: false,
|
||||||
body: None,
|
body: None,
|
||||||
preserve_content_codings: false,
|
preserve_content_codings: false,
|
||||||
|
@ -116,7 +118,7 @@ impl Request {
|
||||||
"about" => match self.url.non_relative_scheme_data() {
|
"about" => match self.url.non_relative_scheme_data() {
|
||||||
Some(s) if s.as_slice() == "blank" => {
|
Some(s) if s.as_slice() == "blank" => {
|
||||||
let mut response = Response::new();
|
let mut response = Response::new();
|
||||||
let _ = response.headers.insert_raw("Content-Type".to_string(), b"text/html;charset=utf-8");
|
response.headers.set(ContentType(Mime(Text, Html, vec![(Charset, Utf8)])));
|
||||||
response
|
response
|
||||||
},
|
},
|
||||||
_ => Response::network_error()
|
_ => Response::network_error()
|
||||||
|
|
|
@ -3,11 +3,10 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use http::status::{Status, UnregisteredStatus};
|
use hyper::status::StatusCode;
|
||||||
use http::status::Ok as StatusOk;
|
use hyper::status::Ok as StatusOk;
|
||||||
use http::headers::HeaderEnum;
|
use hyper::header::Headers;
|
||||||
use http::headers::response::HeaderCollection;
|
use std::ascii::AsciiExt;
|
||||||
use std::ascii::OwnedAsciiExt;
|
|
||||||
use std::comm::Receiver;
|
use std::comm::Receiver;
|
||||||
|
|
||||||
/// [Response type](http://fetch.spec.whatwg.org/#concept-response-type)
|
/// [Response type](http://fetch.spec.whatwg.org/#concept-response-type)
|
||||||
|
@ -57,8 +56,9 @@ pub struct Response {
|
||||||
pub response_type: ResponseType,
|
pub response_type: ResponseType,
|
||||||
pub termination_reason: Option<TerminationReason>,
|
pub termination_reason: Option<TerminationReason>,
|
||||||
pub url: Option<Url>,
|
pub url: Option<Url>,
|
||||||
pub status: Status,
|
/// `None` can be considered a StatusCode of `0`.
|
||||||
pub headers: HeaderCollection,
|
pub status: Option<StatusCode>,
|
||||||
|
pub headers: Headers,
|
||||||
pub body: ResponseBody,
|
pub body: ResponseBody,
|
||||||
/// [Internal response](http://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response is a filtered response
|
/// [Internal response](http://fetch.spec.whatwg.org/#concept-internal-response), only used if the Response is a filtered response
|
||||||
pub internal_response: Option<Box<Response>>,
|
pub internal_response: Option<Box<Response>>,
|
||||||
|
@ -70,8 +70,8 @@ impl Response {
|
||||||
response_type: Default,
|
response_type: Default,
|
||||||
termination_reason: None,
|
termination_reason: None,
|
||||||
url: None,
|
url: None,
|
||||||
status: StatusOk,
|
status: Some(StatusOk),
|
||||||
headers: HeaderCollection::new(),
|
headers: Headers::new(),
|
||||||
body: Empty,
|
body: Empty,
|
||||||
internal_response: None
|
internal_response: None
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,8 @@ impl Response {
|
||||||
response_type: Error,
|
response_type: Error,
|
||||||
termination_reason: None,
|
termination_reason: None,
|
||||||
url: None,
|
url: None,
|
||||||
status: UnregisteredStatus(0, "".to_string()),
|
status: None,
|
||||||
headers: HeaderCollection::new(),
|
headers: Headers::new(),
|
||||||
body: Empty,
|
body: Empty,
|
||||||
internal_response: None
|
internal_response: None
|
||||||
}
|
}
|
||||||
|
@ -110,32 +110,30 @@ impl Response {
|
||||||
match filter_type {
|
match filter_type {
|
||||||
Default | Error => unreachable!(),
|
Default | Error => unreachable!(),
|
||||||
Basic => {
|
Basic => {
|
||||||
let mut headers = HeaderCollection::new();
|
let headers = old_headers.iter().filter(|header| {
|
||||||
for h in old_headers.iter() {
|
match header.name().to_ascii_lower().as_slice() {
|
||||||
match h.header_name().into_ascii_lower().as_slice() {
|
"set-cookie" | "set-cookie2" => false,
|
||||||
"set-cookie" | "set-cookie2" => {},
|
_ => true
|
||||||
_ => headers.insert(h)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}).collect();
|
||||||
response.headers = headers;
|
response.headers = headers;
|
||||||
response.response_type = filter_type;
|
response.response_type = filter_type;
|
||||||
},
|
},
|
||||||
CORS => {
|
CORS => {
|
||||||
let mut headers = HeaderCollection::new();
|
let headers = old_headers.iter().filter(|header| {
|
||||||
for h in old_headers.iter() {
|
match header.name().to_ascii_lower().as_slice() {
|
||||||
match h.header_name().into_ascii_lower().as_slice() {
|
|
||||||
"cache-control" | "content-language" |
|
"cache-control" | "content-language" |
|
||||||
"content-type" | "expires" | "last-modified" | "Pragma" => {},
|
"content-type" | "expires" | "last-modified" | "Pragma" => false,
|
||||||
// XXXManishearth handle Access-Control-Expose-Headers
|
// XXXManishearth handle Access-Control-Expose-Headers
|
||||||
_ => headers.insert(h)
|
_ => true
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}).collect();
|
||||||
response.headers = headers;
|
response.headers = headers;
|
||||||
response.response_type = filter_type;
|
response.response_type = filter_type;
|
||||||
},
|
},
|
||||||
Opaque => {
|
Opaque => {
|
||||||
response.headers = HeaderCollection::new();
|
response.headers = Headers::new();
|
||||||
response.status = UnregisteredStatus(0, "".to_string());
|
response.status = None;
|
||||||
response.body = Empty;
|
response.body = Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,13 @@ use resource_task::{Metadata, Payload, Done, TargetedLoadResponse, LoadData, sta
|
||||||
|
|
||||||
use log;
|
use log;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use http::client::{RequestWriter, NetworkStream};
|
use hyper::client::Request;
|
||||||
use http::headers::HeaderEnum;
|
use hyper::header::common::{ContentLength, ContentType, Host, Location};
|
||||||
|
use hyper::method::{Get, Head};
|
||||||
|
use hyper::status::Redirection;
|
||||||
use std::io::Reader;
|
use std::io::Reader;
|
||||||
use servo_util::task::spawn_named;
|
use servo_util::task::spawn_named;
|
||||||
use url::Url;
|
use url::{Url, UrlParser};
|
||||||
|
|
||||||
pub fn factory(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
pub fn factory(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
||||||
spawn_named("http_loader", proc() load(load_data, start_chan))
|
spawn_named("http_loader", proc() load(load_data, start_chan))
|
||||||
|
@ -67,55 +69,75 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
||||||
|
|
||||||
info!("requesting {:s}", url.serialize());
|
info!("requesting {:s}", url.serialize());
|
||||||
|
|
||||||
let request = RequestWriter::<NetworkStream>::new(load_data.method.clone(), url.clone());
|
let mut req = match Request::new(load_data.method.clone(), url.clone()) {
|
||||||
let mut writer = match request {
|
Ok(req) => req,
|
||||||
Ok(w) => box w,
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
send_error(url, e.desc.to_string(), senders);
|
send_error(url, e.to_string(), senders);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Preserve the `host` header set automatically by RequestWriter.
|
// Preserve the `host` header set automatically by Request.
|
||||||
let host = writer.headers.host.clone();
|
let host = req.headers().get::<Host>().unwrap().clone();
|
||||||
writer.headers = load_data.headers.clone();
|
*req.headers_mut() = load_data.headers.clone();
|
||||||
writer.headers.host = host;
|
req.headers_mut().set(host);
|
||||||
if writer.headers.accept_encoding.is_none() {
|
// FIXME(seanmonstar): use AcceptEncoding from Hyper once available
|
||||||
|
//if !req.headers.has::<AcceptEncoding>() {
|
||||||
// We currently don't support HTTP Compression (FIXME #2587)
|
// We currently don't support HTTP Compression (FIXME #2587)
|
||||||
writer.headers.accept_encoding = Some(String::from_str("identity".as_slice()))
|
req.headers_mut().set_raw("Accept-Encoding", vec![b"identity".to_vec()]);
|
||||||
}
|
//}
|
||||||
match load_data.data {
|
let writer = match load_data.data {
|
||||||
Some(ref data) => {
|
Some(ref data) => {
|
||||||
writer.headers.content_length = Some(data.len());
|
req.headers_mut().set(ContentLength(data.len()));
|
||||||
|
let mut writer = match req.start() {
|
||||||
|
Ok(w) => w,
|
||||||
|
Err(e) => {
|
||||||
|
send_error(url, e.to_string(), senders);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
match writer.write(data.as_slice()) {
|
match writer.write(data.as_slice()) {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
send_error(url, e.desc.to_string(), senders);
|
send_error(url, e.desc.to_string(), senders);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
};
|
||||||
|
writer
|
||||||
},
|
},
|
||||||
_ => {}
|
None => {
|
||||||
|
match load_data.method {
|
||||||
|
Get | Head => (),
|
||||||
|
_ => req.headers_mut().set(ContentLength(0))
|
||||||
}
|
}
|
||||||
let mut response = match writer.read_response() {
|
match req.start() {
|
||||||
|
Ok(w) => w,
|
||||||
|
Err(e) => {
|
||||||
|
send_error(url, e.to_string(), senders);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
let mut response = match writer.send() {
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
Err((_, e)) => {
|
Err(e) => {
|
||||||
send_error(url, e.desc.to_string(), senders);
|
send_error(url, e.to_string(), senders);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Dump headers, but only do the iteration if info!() is enabled.
|
// Dump headers, but only do the iteration if info!() is enabled.
|
||||||
info!("got HTTP response {:s}, headers:", response.status.to_string());
|
info!("got HTTP response {}, headers:", response.status);
|
||||||
if log_enabled!(log::INFO) {
|
if log_enabled!(log::INFO) {
|
||||||
for header in response.headers.iter() {
|
for header in response.headers.iter() {
|
||||||
info!(" - {:s}: {:s}", header.header_name(), header.header_value());
|
info!(" - {}", header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if 3 == (response.status.code() / 100) {
|
if response.status.class() == Redirection {
|
||||||
match response.headers.location {
|
match response.headers.get::<Location>() {
|
||||||
Some(new_url) => {
|
Some(&Location(ref new_url)) => {
|
||||||
// CORS (http://fetch.spec.whatwg.org/#http-fetch, status section, point 9, 10)
|
// CORS (http://fetch.spec.whatwg.org/#http-fetch, status section, point 9, 10)
|
||||||
match load_data.cors {
|
match load_data.cors {
|
||||||
Some(ref c) => {
|
Some(ref c) => {
|
||||||
|
@ -130,7 +152,14 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
info!("redirecting to {:s}", new_url.serialize());
|
let new_url = match UrlParser::new().base_url(&url).parse(new_url.as_slice()) {
|
||||||
|
Ok(u) => u,
|
||||||
|
Err(e) => {
|
||||||
|
send_error(url, e.to_string(), senders);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
info!("redirecting to {}", new_url);
|
||||||
url = new_url;
|
url = new_url;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -139,9 +168,12 @@ fn load(load_data: LoadData, start_chan: Sender<TargetedLoadResponse>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut metadata = Metadata::default(url);
|
let mut metadata = Metadata::default(url);
|
||||||
metadata.set_content_type(&response.headers.content_type);
|
metadata.set_content_type(match response.headers.get() {
|
||||||
|
Some(&ContentType(ref mime)) => Some(mime),
|
||||||
|
None => None
|
||||||
|
});
|
||||||
metadata.headers = Some(response.headers.clone());
|
metadata.headers = Some(response.headers.clone());
|
||||||
metadata.status = Some(response.status.clone());
|
metadata.status = Some(response.status_raw().clone());
|
||||||
|
|
||||||
let progress_chan = match start_sending_opt(senders, metadata) {
|
let progress_chan = match start_sending_opt(senders, metadata) {
|
||||||
Ok(p) => p,
|
Ok(p) => p,
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
extern crate collections;
|
extern crate collections;
|
||||||
extern crate geom;
|
extern crate geom;
|
||||||
extern crate http;
|
extern crate hyper;
|
||||||
extern crate png;
|
extern crate png;
|
||||||
#[phase(plugin, link)]
|
#[phase(plugin, link)]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
|
|
|
@ -12,14 +12,13 @@ use sniffer_task;
|
||||||
use sniffer_task::SnifferTask;
|
use sniffer_task::SnifferTask;
|
||||||
|
|
||||||
use std::comm::{channel, Receiver, Sender};
|
use std::comm::{channel, Receiver, Sender};
|
||||||
use http::headers::content_type::MediaType;
|
use hyper::mime::{Mime, Charset};
|
||||||
use http::headers::response::HeaderCollection as ResponseHeaderCollection;
|
use hyper::header::Headers;
|
||||||
use http::headers::request::HeaderCollection as RequestHeaderCollection;
|
use hyper::header::common::UserAgent;
|
||||||
use http::method::{Method, Get};
|
use hyper::method::{Method, Get};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
use http::status::Ok as StatusOk;
|
use hyper::http::RawStatus;
|
||||||
use http::status::Status;
|
|
||||||
|
|
||||||
use servo_util::task::spawn_named;
|
use servo_util::task::spawn_named;
|
||||||
|
|
||||||
|
@ -33,7 +32,7 @@ pub enum ControlMsg {
|
||||||
pub struct LoadData {
|
pub struct LoadData {
|
||||||
pub url: Url,
|
pub url: Url,
|
||||||
pub method: Method,
|
pub method: Method,
|
||||||
pub headers: RequestHeaderCollection,
|
pub headers: Headers,
|
||||||
pub data: Option<Vec<u8>>,
|
pub data: Option<Vec<u8>>,
|
||||||
pub cors: Option<ResourceCORSData>,
|
pub cors: Option<ResourceCORSData>,
|
||||||
pub consumer: Sender<LoadResponse>,
|
pub consumer: Sender<LoadResponse>,
|
||||||
|
@ -44,7 +43,7 @@ impl LoadData {
|
||||||
LoadData {
|
LoadData {
|
||||||
url: url,
|
url: url,
|
||||||
method: Get,
|
method: Get,
|
||||||
headers: RequestHeaderCollection::new(),
|
headers: Headers::new(),
|
||||||
data: None,
|
data: None,
|
||||||
cors: None,
|
cors: None,
|
||||||
consumer: consumer,
|
consumer: consumer,
|
||||||
|
@ -72,10 +71,10 @@ pub struct Metadata {
|
||||||
pub charset: Option<String>,
|
pub charset: Option<String>,
|
||||||
|
|
||||||
/// Headers
|
/// Headers
|
||||||
pub headers: Option<ResponseHeaderCollection>,
|
pub headers: Option<Headers>,
|
||||||
|
|
||||||
/// HTTP Status
|
/// HTTP Status
|
||||||
pub status: Option<Status>
|
pub status: Option<RawStatus>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Metadata {
|
impl Metadata {
|
||||||
|
@ -86,21 +85,19 @@ impl Metadata {
|
||||||
content_type: None,
|
content_type: None,
|
||||||
charset: None,
|
charset: None,
|
||||||
headers: None,
|
headers: None,
|
||||||
status: Some(StatusOk) // http://fetch.spec.whatwg.org/#concept-response-status-message
|
status: Some(RawStatus(200, "OK".into_string())) // http://fetch.spec.whatwg.org/#concept-response-status-message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Extract the parts of a MediaType that we care about.
|
/// Extract the parts of a Mime that we care about.
|
||||||
pub fn set_content_type(&mut self, content_type: &Option<MediaType>) {
|
pub fn set_content_type(&mut self, content_type: Option<&Mime>) {
|
||||||
match *content_type {
|
match content_type {
|
||||||
None => (),
|
None => (),
|
||||||
Some(MediaType { ref type_,
|
Some(&Mime(ref type_, ref subtype, ref parameters)) => {
|
||||||
ref subtype,
|
self.content_type = Some((type_.to_string(), subtype.to_string()));
|
||||||
ref parameters }) => {
|
|
||||||
self.content_type = Some((type_.clone(), subtype.clone()));
|
|
||||||
for &(ref k, ref v) in parameters.iter() {
|
for &(ref k, ref v) in parameters.iter() {
|
||||||
if "charset" == k.as_slice() {
|
if &Charset == k {
|
||||||
self.charset = Some(v.clone());
|
self.charset = Some(v.to_string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -224,7 +221,7 @@ impl ResourceManager {
|
||||||
|
|
||||||
fn load(&self, load_data: LoadData) {
|
fn load(&self, load_data: LoadData) {
|
||||||
let mut load_data = load_data;
|
let mut load_data = load_data;
|
||||||
load_data.headers.user_agent = self.user_agent.clone();
|
self.user_agent.as_ref().map(|ua| load_data.headers.set(UserAgent(ua.clone())));
|
||||||
let senders = ResponseSenders {
|
let senders = ResponseSenders {
|
||||||
immediate_consumer: self.sniffer_task.clone(),
|
immediate_consumer: self.sniffer_task.clone(),
|
||||||
eventual_consumer: load_data.consumer.clone(),
|
eventual_consumer: load_data.consumer.clone(),
|
||||||
|
|
|
@ -52,8 +52,8 @@ branch = "servo"
|
||||||
[dependencies.encoding]
|
[dependencies.encoding]
|
||||||
git = "https://github.com/lifthrasiir/rust-encoding"
|
git = "https://github.com/lifthrasiir/rust-encoding"
|
||||||
|
|
||||||
[dependencies.http]
|
[dependencies.hyper]
|
||||||
git = "https://github.com/servo/rust-http"
|
git = "https://github.com/servo/hyper"
|
||||||
branch = "servo"
|
branch = "servo"
|
||||||
|
|
||||||
[dependencies.js]
|
[dependencies.js]
|
||||||
|
|
|
@ -9,23 +9,21 @@
|
||||||
//! This library will eventually become the core of the Fetch crate
|
//! This library will eventually become the core of the Fetch crate
|
||||||
//! with CORSRequest being expanded into FetchRequest (etc)
|
//! with CORSRequest being expanded into FetchRequest (etc)
|
||||||
|
|
||||||
use std::ascii::{AsciiExt, OwnedAsciiExt};
|
use std::ascii::AsciiExt;
|
||||||
use std::from_str::FromStr;
|
use std::fmt::{mod, Show};
|
||||||
use std::io::BufReader;
|
use std::str::from_utf8;
|
||||||
use time;
|
use time;
|
||||||
use time::{now, Timespec};
|
use time::{now, Timespec};
|
||||||
|
|
||||||
use http::headers::response::HeaderCollection as ResponseHeaderCollection;
|
use hyper::header::{Headers, Header, HeaderFormat, HeaderView};
|
||||||
use http::headers::request::HeaderCollection as RequestHeaderCollection;
|
use hyper::header::common::util as header_util;
|
||||||
use http::headers::request::Header as RequestHeader;
|
use hyper::client::Request;
|
||||||
|
use hyper::mime::{mod, Mime};
|
||||||
|
use hyper::header::common::{ContentType, Host};
|
||||||
|
use hyper::method::{Method, Get, Head, Post, Options};
|
||||||
|
use hyper::status::Success;
|
||||||
|
|
||||||
use http::client::{RequestWriter, NetworkStream};
|
use url::{RelativeSchemeData, Url};
|
||||||
use http::headers::{HeaderConvertible, HeaderEnum, HeaderValueByteIterator};
|
|
||||||
use http::headers::content_type::MediaType;
|
|
||||||
use http::headers::request::{Accept, AcceptLanguage, ContentLanguage, ContentType};
|
|
||||||
use http::method::{Method, Get, Head, Post, Options};
|
|
||||||
|
|
||||||
use url::{RelativeSchemeData, Url, UrlParser};
|
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[deriving(Clone)]
|
||||||
pub struct CORSRequest {
|
pub struct CORSRequest {
|
||||||
|
@ -33,7 +31,7 @@ pub struct CORSRequest {
|
||||||
pub destination: Url,
|
pub destination: Url,
|
||||||
pub mode: RequestMode,
|
pub mode: RequestMode,
|
||||||
pub method: Method,
|
pub method: Method,
|
||||||
pub headers: RequestHeaderCollection,
|
pub headers: Headers,
|
||||||
/// CORS preflight flag (http://fetch.spec.whatwg.org/#concept-http-fetch)
|
/// CORS preflight flag (http://fetch.spec.whatwg.org/#concept-http-fetch)
|
||||||
/// Indicates that a CORS preflight request and/or cache check is to be performed
|
/// Indicates that a CORS preflight request and/or cache check is to be performed
|
||||||
pub preflight_flag: bool
|
pub preflight_flag: bool
|
||||||
|
@ -51,7 +49,7 @@ pub enum RequestMode {
|
||||||
impl CORSRequest {
|
impl CORSRequest {
|
||||||
/// Creates a CORS request if necessary. Will return an error when fetching is forbidden
|
/// Creates a CORS request if necessary. Will return an error when fetching is forbidden
|
||||||
pub fn maybe_new(referer: Url, destination: Url, mode: RequestMode,
|
pub fn maybe_new(referer: Url, destination: Url, mode: RequestMode,
|
||||||
method: Method, headers: RequestHeaderCollection) -> Result<Option<CORSRequest>, ()> {
|
method: Method, headers: Headers) -> Result<Option<CORSRequest>, ()> {
|
||||||
if referer.scheme == destination.scheme &&
|
if referer.scheme == destination.scheme &&
|
||||||
referer.host() == destination.host() &&
|
referer.host() == destination.host() &&
|
||||||
referer.port() == destination.port() {
|
referer.port() == destination.port() {
|
||||||
|
@ -73,7 +71,7 @@ impl CORSRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new(mut referer: Url, destination: Url, mode: RequestMode, method: Method,
|
fn new(mut referer: Url, destination: Url, mode: RequestMode, method: Method,
|
||||||
headers: RequestHeaderCollection) -> CORSRequest {
|
headers: Headers) -> CORSRequest {
|
||||||
match referer.scheme_data {
|
match referer.scheme_data {
|
||||||
RelativeSchemeData(ref mut data) => data.path = vec!(),
|
RelativeSchemeData(ref mut data) => data.path = vec!(),
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -104,7 +102,7 @@ impl CORSRequest {
|
||||||
let cache = &mut CORSCache(vec!()); // XXXManishearth Should come from user agent
|
let cache = &mut CORSCache(vec!()); // XXXManishearth Should come from user agent
|
||||||
if self.preflight_flag &&
|
if self.preflight_flag &&
|
||||||
!cache.match_method(self, &self.method) &&
|
!cache.match_method(self, &self.method) &&
|
||||||
!self.headers.iter().all(|h| is_simple_header(&h) && cache.match_header(self, h.header_name().as_slice())) {
|
!self.headers.iter().all(|h| is_simple_header(&h) && cache.match_header(self, h.name())) {
|
||||||
if !is_simple_method(&self.method) || self.mode == ForcedPreflightMode {
|
if !is_simple_method(&self.method) || self.mode == ForcedPreflightMode {
|
||||||
return self.preflight_fetch();
|
return self.preflight_fetch();
|
||||||
// Everything after this is part of XHR::fetch()
|
// Everything after this is part of XHR::fetch()
|
||||||
|
@ -121,69 +119,63 @@ impl CORSRequest {
|
||||||
|
|
||||||
let mut preflight = self.clone(); // Step 1
|
let mut preflight = self.clone(); // Step 1
|
||||||
preflight.method = Options; // Step 2
|
preflight.method = Options; // Step 2
|
||||||
preflight.headers = RequestHeaderCollection::new(); // Step 3
|
preflight.headers = Headers::new(); // Step 3
|
||||||
// Step 4
|
// Step 4
|
||||||
preflight.insert_string_header("Access-Control-Request-Method".to_string(), self.method.http_value());
|
preflight.headers.set(AccessControlRequestMethod(self.method.clone()));
|
||||||
|
|
||||||
// Step 5 - 7
|
// Step 5 - 7
|
||||||
let mut header_names = vec!();
|
let mut header_names = vec!();
|
||||||
for header in self.headers.iter() {
|
for header in self.headers.iter() {
|
||||||
header_names.push(header.header_name().into_ascii_lower());
|
header_names.push(header.name().to_ascii_lower());
|
||||||
}
|
}
|
||||||
header_names.sort();
|
header_names.sort();
|
||||||
let header_list = header_names.connect(", "); // 0x2C 0x20
|
preflight.headers.set(AccessControlRequestHeaders(header_names));
|
||||||
preflight.insert_string_header("Access-Control-Request-Headers".to_string(), header_list);
|
|
||||||
|
|
||||||
// Step 8 unnecessary, we don't use the request body
|
// Step 8 unnecessary, we don't use the request body
|
||||||
// Step 9, 10 unnecessary, we're writing our own fetch code
|
// Step 9, 10 unnecessary, we're writing our own fetch code
|
||||||
|
|
||||||
// Step 11
|
// Step 11
|
||||||
let preflight_request = RequestWriter::<NetworkStream>::new(preflight.method, preflight.destination);
|
let preflight_request = Request::new(preflight.method, preflight.destination);
|
||||||
let mut writer = match preflight_request {
|
let mut req = match preflight_request {
|
||||||
Ok(w) => box w,
|
Ok(req) => req,
|
||||||
Err(_) => return error
|
Err(_) => return error
|
||||||
};
|
};
|
||||||
|
|
||||||
let host = writer.headers.host.clone();
|
let host = req.headers().get::<Host>().unwrap().clone();
|
||||||
writer.headers = preflight.headers.clone();
|
*req.headers_mut() = preflight.headers.clone();
|
||||||
writer.headers.host = host;
|
req.headers_mut().set(host);
|
||||||
let response = match writer.read_response() {
|
let stream = match req.start() {
|
||||||
|
Ok(s) => s,
|
||||||
|
Err(_) => return error
|
||||||
|
};
|
||||||
|
let response = match stream.send() {
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
Err(_) => return error
|
Err(_) => return error
|
||||||
};
|
};
|
||||||
|
|
||||||
// Step 12
|
// Step 12
|
||||||
match response.status.code() {
|
match response.status.class() {
|
||||||
200 ... 299 => {}
|
Success => {}
|
||||||
_ => return error
|
_ => return error
|
||||||
}
|
}
|
||||||
cors_response.headers = response.headers.clone();
|
cors_response.headers = response.headers.clone();
|
||||||
// Substeps 1-3 (parsing rules: http://fetch.spec.whatwg.org/#http-new-header-syntax)
|
// Substeps 1-3 (parsing rules: http://fetch.spec.whatwg.org/#http-new-header-syntax)
|
||||||
fn find_header(headers: &ResponseHeaderCollection, name: &str) -> Option<String> {
|
let mut methods = match response.headers.get() {
|
||||||
headers.iter().find(|h| h.header_name().as_slice()
|
Some(&AccessControlAllowMethods(ref v)) => v.as_slice(),
|
||||||
.eq_ignore_ascii_case(name))
|
|
||||||
.map(|h| h.header_value())
|
|
||||||
}
|
|
||||||
let methods_string = match find_header(&response.headers, "Access-Control-Allow-Methods") {
|
|
||||||
Some(s) => s,
|
|
||||||
_ => return error
|
_ => return error
|
||||||
};
|
};
|
||||||
let methods = methods_string.as_slice().split(',');
|
let headers = match response.headers.get() {
|
||||||
let headers_string = match find_header(&response.headers, "Access-Control-Allow-Headers") {
|
Some(&AccessControlAllowHeaders(ref h)) => h,
|
||||||
Some(s) => s,
|
|
||||||
_ => return error
|
_ => return error
|
||||||
};
|
};
|
||||||
let headers = headers_string.as_slice().split(0x2Cu8 as char);
|
|
||||||
// The ABNF # rule will consider consecutive delimeters as a single delimeter
|
|
||||||
let mut methods: Vec<String> = methods.filter(|s| s.len() > 0).map(|s| s.to_string()).collect();
|
|
||||||
let headers: Vec<String> = headers.filter(|s| s.len() > 0).map(|s| s.to_string()).collect();
|
|
||||||
// Substep 4
|
// Substep 4
|
||||||
|
let methods_substep4 = [self.method.clone()];
|
||||||
if methods.len() == 0 || preflight.mode == ForcedPreflightMode {
|
if methods.len() == 0 || preflight.mode == ForcedPreflightMode {
|
||||||
methods = vec!(self.method.http_value());
|
methods = methods_substep4.as_slice();
|
||||||
}
|
}
|
||||||
// Substep 5
|
// Substep 5
|
||||||
if !is_simple_method(&self.method) &&
|
if !is_simple_method(&self.method) &&
|
||||||
!methods.iter().any(|ref m| self.method.http_value().as_slice().eq_ignore_ascii_case(m.as_slice())) {
|
!methods.iter().any(|m| m == &self.method) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
// Substep 6
|
// Substep 6
|
||||||
|
@ -191,30 +183,29 @@ impl CORSRequest {
|
||||||
if is_simple_header(&h) {
|
if is_simple_header(&h) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if !headers.iter().any(|ref h2| h.header_name().as_slice().eq_ignore_ascii_case(h2.as_slice())) {
|
if !headers.iter().any(|ref h2| h.name().eq_ignore_ascii_case(h2.as_slice())) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Substep 7, 8
|
// Substep 7, 8
|
||||||
let max_age: uint = find_header(&response.headers, "Access-Control-Max-Age")
|
let max_age = match response.headers.get() {
|
||||||
.and_then(|h| FromStr::from_str(h.as_slice())).unwrap_or(0);
|
Some(&AccessControlMaxAge(num)) => num,
|
||||||
|
None => 0
|
||||||
|
};
|
||||||
// Substep 9: Impose restrictions on max-age, if any (unimplemented)
|
// Substep 9: Impose restrictions on max-age, if any (unimplemented)
|
||||||
// Substeps 10-12: Add a cache (partially implemented, XXXManishearth)
|
// Substeps 10-12: Add a cache (partially implemented, XXXManishearth)
|
||||||
// This cache should come from the user agent, creating a new one here to check
|
// This cache should come from the user agent, creating a new one here to check
|
||||||
// for compile time errors
|
// for compile time errors
|
||||||
let cache = &mut CORSCache(vec!());
|
let cache = &mut CORSCache(vec!());
|
||||||
for m in methods.iter() {
|
for m in methods.iter() {
|
||||||
let maybe_method: Option<Method> = FromStr::from_str(m.as_slice());
|
|
||||||
maybe_method.map(|ref m| {
|
|
||||||
let cache_match = cache.match_method_and_update(self, m, max_age);
|
let cache_match = cache.match_method_and_update(self, m, max_age);
|
||||||
if !cache_match {
|
if !cache_match {
|
||||||
cache.insert(CORSCacheEntry::new(self.origin.clone(), self.destination.clone(),
|
cache.insert(CORSCacheEntry::new(self.origin.clone(), self.destination.clone(),
|
||||||
max_age, false, MethodData(m.clone())));
|
max_age, false, MethodData(m.clone())));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
for h in headers.iter() {
|
for h in response.headers.iter() {
|
||||||
let cache_match = cache.match_header_and_update(self, h.as_slice(), max_age);
|
let cache_match = cache.match_header_and_update(self, h.name(), max_age);
|
||||||
if !cache_match {
|
if !cache_match {
|
||||||
cache.insert(CORSCacheEntry::new(self.origin.clone(), self.destination.clone(),
|
cache.insert(CORSCacheEntry::new(self.origin.clone(), self.destination.clone(),
|
||||||
max_age, false, HeaderData(h.to_string())));
|
max_age, false, HeaderData(h.to_string())));
|
||||||
|
@ -222,35 +213,26 @@ impl CORSRequest {
|
||||||
}
|
}
|
||||||
cors_response
|
cors_response
|
||||||
}
|
}
|
||||||
|
|
||||||
fn insert_string_header(&mut self, name: String, value: String) {
|
|
||||||
let value_bytes = value.into_bytes();
|
|
||||||
let mut reader = BufReader::new(value_bytes.as_slice());
|
|
||||||
let maybe_header: Option<RequestHeader> = HeaderEnum::value_from_stream(
|
|
||||||
String::from_str(name.as_slice()),
|
|
||||||
&mut HeaderValueByteIterator::new(&mut reader));
|
|
||||||
self.headers.insert(maybe_header.unwrap());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub struct CORSResponse {
|
pub struct CORSResponse {
|
||||||
pub network_error: bool,
|
pub network_error: bool,
|
||||||
pub headers: ResponseHeaderCollection
|
pub headers: Headers
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CORSResponse {
|
impl CORSResponse {
|
||||||
fn new() -> CORSResponse {
|
fn new() -> CORSResponse {
|
||||||
CORSResponse {
|
CORSResponse {
|
||||||
network_error: false,
|
network_error: false,
|
||||||
headers: ResponseHeaderCollection::new()
|
headers: Headers::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_error() -> CORSResponse {
|
fn new_error() -> CORSResponse {
|
||||||
CORSResponse {
|
CORSResponse {
|
||||||
network_error: true,
|
network_error: true,
|
||||||
headers: ResponseHeaderCollection::new()
|
headers: Headers::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,14 +272,14 @@ impl HeaderOrMethod {
|
||||||
pub struct CORSCacheEntry {
|
pub struct CORSCacheEntry {
|
||||||
pub origin: Url,
|
pub origin: Url,
|
||||||
pub url: Url,
|
pub url: Url,
|
||||||
pub max_age: uint,
|
pub max_age: u32,
|
||||||
pub credentials: bool,
|
pub credentials: bool,
|
||||||
pub header_or_method: HeaderOrMethod,
|
pub header_or_method: HeaderOrMethod,
|
||||||
created: Timespec
|
created: Timespec
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CORSCacheEntry {
|
impl CORSCacheEntry {
|
||||||
fn new (origin:Url, url: Url, max_age: uint, credentials: bool, header_or_method: HeaderOrMethod) -> CORSCacheEntry {
|
fn new (origin:Url, url: Url, max_age: u32, credentials: bool, header_or_method: HeaderOrMethod) -> CORSCacheEntry {
|
||||||
CORSCacheEntry {
|
CORSCacheEntry {
|
||||||
origin: origin,
|
origin: origin,
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -343,7 +325,7 @@ impl CORSCache {
|
||||||
self.find_entry_by_header(request, header_name).is_some()
|
self.find_entry_by_header(request, header_name).is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn match_header_and_update(&mut self, request: &CORSRequest, header_name: &str, new_max_age: uint) -> bool {
|
fn match_header_and_update(&mut self, request: &CORSRequest, header_name: &str, new_max_age: u32) -> bool {
|
||||||
self.find_entry_by_header(request, header_name).map(|e| e.max_age = new_max_age).is_some()
|
self.find_entry_by_header(request, header_name).map(|e| e.max_age = new_max_age).is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,7 +347,7 @@ impl CORSCache {
|
||||||
self.find_entry_by_method(request, method).is_some()
|
self.find_entry_by_method(request, method).is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn match_method_and_update(&mut self, request: &CORSRequest, method: &Method, new_max_age: uint) -> bool {
|
fn match_method_and_update(&mut self, request: &CORSRequest, method: &Method, new_max_age: u32) -> bool {
|
||||||
self.find_entry_by_method(request, method).map(|e| e.max_age = new_max_age).is_some()
|
self.find_entry_by_method(request, method).map(|e| e.max_age = new_max_age).is_some()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,12 +358,18 @@ impl CORSCache {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_simple_header(h: &RequestHeader) -> bool {
|
fn is_simple_header(h: &HeaderView) -> bool {
|
||||||
match *h {
|
//FIXME: use h.is::<HeaderType>() when AcceptLanguage and
|
||||||
Accept(_) | AcceptLanguage(_) | ContentLanguage(_) => true,
|
//ContentLanguage headers exist
|
||||||
ContentType(MediaType {type_: ref t, subtype: ref s, ..}) => match (t.as_slice(), s.as_slice()) {
|
match h.name().to_ascii_lower().as_slice() {
|
||||||
("text", "plain") | ("application", "x-www-form-urlencoded") | ("multipart", "form-data") => true,
|
"accept" | "accept-language" | "content-language" => true,
|
||||||
|
"content-type" => match h.value() {
|
||||||
|
Some(&ContentType(Mime(mime::Text, mime::Plain, _))) |
|
||||||
|
Some(&ContentType(Mime(mime::Application, mime::WwwFormUrlEncoded, _))) |
|
||||||
|
Some(&ContentType(Mime(mime::Multipart, mime::FormData, _))) => true,
|
||||||
|
|
||||||
_ => false
|
_ => false
|
||||||
|
|
||||||
},
|
},
|
||||||
_ => false
|
_ => false
|
||||||
}
|
}
|
||||||
|
@ -394,25 +382,160 @@ fn is_simple_method(m: &Method) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//XXX(seanmonstar): worth uplifting to Hyper?
|
||||||
|
#[deriving(Clone)]
|
||||||
|
struct AccessControlRequestMethod(pub Method);
|
||||||
|
|
||||||
|
impl Header for AccessControlRequestMethod {
|
||||||
|
#[inline]
|
||||||
|
fn header_name(_: Option<AccessControlRequestMethod>) -> &'static str {
|
||||||
|
"Access-Control-Request-Method"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlRequestMethod> {
|
||||||
|
header_util::from_one_raw_str(raw).map(AccessControlRequestMethod)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeaderFormat for AccessControlRequestMethod {
|
||||||
|
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let AccessControlRequestMethod(ref method) = *self;
|
||||||
|
method.fmt(f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[deriving(Clone)]
|
||||||
|
struct AccessControlRequestHeaders(pub Vec<String>);
|
||||||
|
|
||||||
|
impl Header for AccessControlRequestHeaders {
|
||||||
|
#[inline]
|
||||||
|
fn header_name(_: Option<AccessControlRequestHeaders>) -> &'static str {
|
||||||
|
"Access-Control-Request-Headers"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlRequestHeaders> {
|
||||||
|
header_util::from_comma_delimited(raw).map(AccessControlRequestHeaders)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeaderFormat for AccessControlRequestHeaders {
|
||||||
|
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let AccessControlRequestHeaders(ref parts) = *self;
|
||||||
|
header_util::fmt_comma_delimited(f, parts.as_slice())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[deriving(Clone)]
|
||||||
|
struct AccessControlAllowMethods(pub Vec<Method>);
|
||||||
|
|
||||||
|
impl Header for AccessControlAllowMethods {
|
||||||
|
#[inline]
|
||||||
|
fn header_name(_: Option<AccessControlAllowMethods>) -> &'static str {
|
||||||
|
"Access-Control-Allow-Methods"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlAllowMethods> {
|
||||||
|
header_util::from_comma_delimited(raw).map(AccessControlAllowMethods)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeaderFormat for AccessControlAllowMethods {
|
||||||
|
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let AccessControlAllowMethods(ref parts) = *self;
|
||||||
|
header_util::fmt_comma_delimited(f, parts.as_slice())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[deriving(Clone)]
|
||||||
|
struct AccessControlAllowHeaders(pub Vec<String>);
|
||||||
|
|
||||||
|
impl Header for AccessControlAllowHeaders {
|
||||||
|
#[inline]
|
||||||
|
fn header_name(_: Option<AccessControlAllowHeaders>) -> &'static str {
|
||||||
|
"Access-Control-Allow-Headers"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlAllowHeaders> {
|
||||||
|
header_util::from_comma_delimited(raw).map(AccessControlAllowHeaders)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeaderFormat for AccessControlAllowHeaders {
|
||||||
|
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let AccessControlAllowHeaders(ref parts) = *self;
|
||||||
|
header_util::fmt_comma_delimited(f, parts.as_slice())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[deriving(Clone)]
|
||||||
|
enum AccessControlAllowOrigin {
|
||||||
|
AllowStar,
|
||||||
|
AllowOrigin(Url),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
impl Header for AccessControlAllowOrigin {
|
||||||
|
#[inline]
|
||||||
|
fn header_name(_: Option<AccessControlAllowOrigin>) -> &'static str {
|
||||||
|
"Access-Control-Allow-Origin"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlAllowOrigin> {
|
||||||
|
if raw.len() == 1 {
|
||||||
|
from_utf8(raw[0].as_slice()).and_then(|s| {
|
||||||
|
if s == "*" {
|
||||||
|
Some(AllowStar)
|
||||||
|
} else {
|
||||||
|
Url::parse(s).ok().map(|url| AllowOrigin(url))
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeaderFormat for AccessControlAllowOrigin {
|
||||||
|
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
match *self {
|
||||||
|
AllowStar => "*".fmt(f),
|
||||||
|
AllowOrigin(ref url) => url.fmt(f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[deriving(Clone)]
|
||||||
|
struct AccessControlMaxAge(pub u32);
|
||||||
|
|
||||||
|
impl Header for AccessControlMaxAge {
|
||||||
|
#[inline]
|
||||||
|
fn header_name(_: Option<AccessControlMaxAge>) -> &'static str {
|
||||||
|
"Access-Control-Max-Age"
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_header(raw: &[Vec<u8>]) -> Option<AccessControlMaxAge> {
|
||||||
|
header_util::from_one_raw_str(raw).map(AccessControlMaxAge)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl HeaderFormat for AccessControlMaxAge {
|
||||||
|
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let AccessControlMaxAge(ref num) = *self;
|
||||||
|
num.fmt(f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Perform a CORS check on a header list and CORS request
|
/// Perform a CORS check on a header list and CORS request
|
||||||
/// http://fetch.spec.whatwg.org/#cors-check
|
/// http://fetch.spec.whatwg.org/#cors-check
|
||||||
pub fn allow_cross_origin_request(req: &CORSRequest, headers: &ResponseHeaderCollection) -> bool {
|
pub fn allow_cross_origin_request(req: &CORSRequest, headers: &Headers) -> bool {
|
||||||
let allow_cross_origin_request = headers.iter().find(|h| h.header_name()
|
//FIXME(seanmonstar): use req.headers.get::<AccessControlAllowOrigin>()
|
||||||
.as_slice()
|
match headers.get() {
|
||||||
.eq_ignore_ascii_case("Access-Control-Allow-Origin"));
|
Some(&AllowStar) => true, // Not always true, depends on credentials mode
|
||||||
match allow_cross_origin_request {
|
Some(&AllowOrigin(ref url)) =>
|
||||||
Some(h) => {
|
url.scheme == req.origin.scheme &&
|
||||||
let origin_str = h.header_value();
|
url.host() == req.origin.host() &&
|
||||||
if origin_str.as_slice() == "*" {
|
url.port() == req.origin.port(),
|
||||||
return true; // Not always true, depends on credentials mode
|
|
||||||
}
|
|
||||||
match UrlParser::new().parse(origin_str.as_slice()) {
|
|
||||||
Ok(parsed) => parsed.scheme == req.origin.scheme &&
|
|
||||||
parsed.host() == req.origin.host() &&
|
|
||||||
parsed.port() == req.origin.port(),
|
|
||||||
_ => false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
None => false
|
None => false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,8 @@ use dom::node::{Node, TrustedNodeAddress};
|
||||||
use collections::hash::{Hash, Hasher};
|
use collections::hash::{Hash, Hasher};
|
||||||
use geom::rect::Rect;
|
use geom::rect::Rect;
|
||||||
use html5ever::tree_builder::QuirksMode;
|
use html5ever::tree_builder::QuirksMode;
|
||||||
use http::headers::request::HeaderCollection as RequestHeaderCollection;
|
use hyper::header::Headers;
|
||||||
use http::headers::response::HeaderCollection as ResponseHeaderCollection;
|
use hyper::method::Method;
|
||||||
use http::method::Method;
|
|
||||||
use js::jsapi::{JSObject, JSTracer, JS_CallTracer, JSTRACE_OBJECT};
|
use js::jsapi::{JSObject, JSTracer, JS_CallTracer, JSTRACE_OBJECT};
|
||||||
use js::jsval::JSVal;
|
use js::jsval::JSVal;
|
||||||
use js::rust::Cx;
|
use js::rust::Cx;
|
||||||
|
@ -209,7 +208,7 @@ no_jsmanaged_fields!(PropertyDeclarationBlock)
|
||||||
no_jsmanaged_fields!(SubpageId, WindowSizeData, PipelineId)
|
no_jsmanaged_fields!(SubpageId, WindowSizeData, PipelineId)
|
||||||
no_jsmanaged_fields!(QuirksMode)
|
no_jsmanaged_fields!(QuirksMode)
|
||||||
no_jsmanaged_fields!(Cx)
|
no_jsmanaged_fields!(Cx)
|
||||||
no_jsmanaged_fields!(ResponseHeaderCollection, RequestHeaderCollection, Method)
|
no_jsmanaged_fields!(Headers, Method)
|
||||||
no_jsmanaged_fields!(ConstellationChan)
|
no_jsmanaged_fields!(ConstellationChan)
|
||||||
no_jsmanaged_fields!(LayoutChan)
|
no_jsmanaged_fields!(LayoutChan)
|
||||||
no_jsmanaged_fields!(WindowProxyHandler)
|
no_jsmanaged_fields!(WindowProxyHandler)
|
||||||
|
|
|
@ -20,7 +20,7 @@ use dom::eventtarget::{EventTarget, NodeTargetTypeId};
|
||||||
use dom::htmlelement::HTMLElement;
|
use dom::htmlelement::HTMLElement;
|
||||||
use dom::htmlinputelement::HTMLInputElement;
|
use dom::htmlinputelement::HTMLInputElement;
|
||||||
use dom::node::{Node, NodeHelpers, ElementNodeTypeId, document_from_node, window_from_node};
|
use dom::node::{Node, NodeHelpers, ElementNodeTypeId, document_from_node, window_from_node};
|
||||||
use http::method::Post;
|
use hyper::method::Post;
|
||||||
use servo_msg::constellation_msg::LoadData;
|
use servo_msg::constellation_msg::LoadData;
|
||||||
use servo_util::str::DOMString;
|
use servo_util::str::DOMString;
|
||||||
use script_task::{ScriptChan, TriggerLoadMsg};
|
use script_task::{ScriptChan, TriggerLoadMsg};
|
||||||
|
|
|
@ -29,13 +29,11 @@ use encoding::all::UTF_8;
|
||||||
use encoding::label::encoding_from_whatwg_label;
|
use encoding::label::encoding_from_whatwg_label;
|
||||||
use encoding::types::{DecodeReplace, Encoding, EncodingRef, EncodeReplace};
|
use encoding::types::{DecodeReplace, Encoding, EncodingRef, EncodeReplace};
|
||||||
|
|
||||||
use http::headers::response::HeaderCollection as ResponseHeaderCollection;
|
use hyper::header::Headers;
|
||||||
use http::headers::request::HeaderCollection as RequestHeaderCollection;
|
use hyper::header::common::{Accept, ContentLength, ContentType};
|
||||||
use http::headers::content_type::MediaType;
|
use hyper::http::RawStatus;
|
||||||
use http::headers::{HeaderEnum, HeaderValueByteIterator};
|
use hyper::mime::{mod, Mime};
|
||||||
use http::headers::request::Header;
|
use hyper::method::{Method, Get, Head, Connect, Trace, Extension};
|
||||||
use http::method::{Method, Get, Head, Connect, Trace, ExtensionMethod};
|
|
||||||
use http::status::Status;
|
|
||||||
|
|
||||||
use js::jsapi::{JS_AddObjectRoot, JS_ParseJSON, JS_RemoveObjectRoot, JSContext};
|
use js::jsapi::{JS_AddObjectRoot, JS_ParseJSON, JS_RemoveObjectRoot, JSContext};
|
||||||
use js::jsapi::JS_ClearPendingException;
|
use js::jsapi::JS_ClearPendingException;
|
||||||
|
@ -54,7 +52,7 @@ use std::ascii::AsciiExt;
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::comm::{Sender, Receiver, channel};
|
use std::comm::{Sender, Receiver, channel};
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::io::{BufReader, MemWriter, Timer};
|
use std::io::Timer;
|
||||||
use std::from_str::FromStr;
|
use std::from_str::FromStr;
|
||||||
use std::time::duration::Duration;
|
use std::time::duration::Duration;
|
||||||
use std::num::Zero;
|
use std::num::Zero;
|
||||||
|
@ -88,7 +86,7 @@ pub struct GenerationId(uint);
|
||||||
|
|
||||||
pub enum XHRProgress {
|
pub enum XHRProgress {
|
||||||
/// Notify that headers have been received
|
/// Notify that headers have been received
|
||||||
HeadersReceivedMsg(GenerationId, Option<ResponseHeaderCollection>, Option<Status>),
|
HeadersReceivedMsg(GenerationId, Option<Headers>, Option<RawStatus>),
|
||||||
/// Partial progress (after receiving headers), containing portion of the response
|
/// Partial progress (after receiving headers), containing portion of the response
|
||||||
LoadingMsg(GenerationId, ByteString),
|
LoadingMsg(GenerationId, ByteString),
|
||||||
/// Loading is done
|
/// Loading is done
|
||||||
|
@ -131,12 +129,12 @@ pub struct XMLHttpRequest {
|
||||||
response: DOMRefCell<ByteString>,
|
response: DOMRefCell<ByteString>,
|
||||||
response_type: Cell<XMLHttpRequestResponseType>,
|
response_type: Cell<XMLHttpRequestResponseType>,
|
||||||
response_xml: MutNullableJS<Document>,
|
response_xml: MutNullableJS<Document>,
|
||||||
response_headers: DOMRefCell<ResponseHeaderCollection>,
|
response_headers: DOMRefCell<Headers>,
|
||||||
|
|
||||||
// Associated concepts
|
// Associated concepts
|
||||||
request_method: DOMRefCell<Method>,
|
request_method: DOMRefCell<Method>,
|
||||||
request_url: DOMRefCell<Option<Url>>,
|
request_url: DOMRefCell<Option<Url>>,
|
||||||
request_headers: DOMRefCell<RequestHeaderCollection>,
|
request_headers: DOMRefCell<Headers>,
|
||||||
request_body_len: Cell<uint>,
|
request_body_len: Cell<uint>,
|
||||||
sync: Cell<bool>,
|
sync: Cell<bool>,
|
||||||
upload_complete: Cell<bool>,
|
upload_complete: Cell<bool>,
|
||||||
|
@ -165,11 +163,11 @@ impl XMLHttpRequest {
|
||||||
response: DOMRefCell::new(ByteString::new(vec!())),
|
response: DOMRefCell::new(ByteString::new(vec!())),
|
||||||
response_type: Cell::new(_empty),
|
response_type: Cell::new(_empty),
|
||||||
response_xml: Default::default(),
|
response_xml: Default::default(),
|
||||||
response_headers: DOMRefCell::new(ResponseHeaderCollection::new()),
|
response_headers: DOMRefCell::new(Headers::new()),
|
||||||
|
|
||||||
request_method: DOMRefCell::new(Get),
|
request_method: DOMRefCell::new(Get),
|
||||||
request_url: DOMRefCell::new(None),
|
request_url: DOMRefCell::new(None),
|
||||||
request_headers: DOMRefCell::new(RequestHeaderCollection::new()),
|
request_headers: DOMRefCell::new(Headers::new()),
|
||||||
request_body_len: Cell::new(0),
|
request_body_len: Cell::new(0),
|
||||||
sync: Cell::new(false),
|
sync: Cell::new(false),
|
||||||
send_flag: Cell::new(false),
|
send_flag: Cell::new(false),
|
||||||
|
@ -345,28 +343,26 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn Open(self, method: ByteString, url: DOMString) -> ErrorResult {
|
fn Open(self, method: ByteString, url: DOMString) -> ErrorResult {
|
||||||
let uppercase_method = method.as_str().map(|s| {
|
//FIXME(seanmonstar): use a Trie instead?
|
||||||
let upper = s.to_ascii_upper();
|
let maybe_method = method.as_str().and_then(|s| {
|
||||||
match upper.as_slice() {
|
// Note: hyper tests against the uppercase versions
|
||||||
"DELETE" | "GET" | "HEAD" | "OPTIONS" |
|
|
||||||
"POST" | "PUT" | "CONNECT" | "TRACE" |
|
|
||||||
"TRACK" => upper,
|
|
||||||
_ => s.to_string()
|
|
||||||
}
|
|
||||||
});
|
|
||||||
let maybe_method: Option<Method> = uppercase_method.and_then(|s| {
|
|
||||||
// Note: rust-http tests against the uppercase versions
|
|
||||||
// Since we want to pass methods not belonging to the short list above
|
// Since we want to pass methods not belonging to the short list above
|
||||||
// without changing capitalization, this will actually sidestep rust-http's type system
|
// without changing capitalization, this will actually sidestep rust-http's type system
|
||||||
// since methods like "patch" or "PaTcH" will be considered extension methods
|
// since methods like "patch" or "PaTcH" will be considered extension methods
|
||||||
// despite the there being a rust-http method variant for them
|
// despite the there being a rust-http method variant for them
|
||||||
Method::from_str_or_new(s.as_slice())
|
let upper = s.to_ascii_upper();
|
||||||
|
match upper.as_slice() {
|
||||||
|
"DELETE" | "GET" | "HEAD" | "OPTIONS" |
|
||||||
|
"POST" | "PUT" | "CONNECT" | "TRACE" |
|
||||||
|
"TRACK" => from_str(upper.as_slice()),
|
||||||
|
_ => from_str(s)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// Step 2
|
// Step 2
|
||||||
match maybe_method {
|
match maybe_method {
|
||||||
// Step 4
|
// Step 4
|
||||||
Some(Connect) | Some(Trace) => Err(Security),
|
Some(Connect) | Some(Trace) => Err(Security),
|
||||||
Some(ExtensionMethod(ref t)) if t.as_slice() == "TRACK" => Err(Security),
|
Some(Extension(ref t)) if t.as_slice() == "TRACK" => Err(Security),
|
||||||
Some(_) if method.is_token() => {
|
Some(_) if method.is_token() => {
|
||||||
|
|
||||||
*self.request_method.borrow_mut() = maybe_method.unwrap();
|
*self.request_method.borrow_mut() = maybe_method.unwrap();
|
||||||
|
@ -389,7 +385,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
|
|
||||||
// Step 12
|
// Step 12
|
||||||
*self.request_url.borrow_mut() = Some(parsed_url);
|
*self.request_url.borrow_mut() = Some(parsed_url);
|
||||||
*self.request_headers.borrow_mut() = RequestHeaderCollection::new();
|
*self.request_headers.borrow_mut() = Headers::new();
|
||||||
self.send_flag.set(false);
|
self.send_flag.set(false);
|
||||||
*self.status_text.borrow_mut() = ByteString::new(vec!());
|
*self.status_text.borrow_mut() = ByteString::new(vec!());
|
||||||
self.status.set(0);
|
self.status.set(0);
|
||||||
|
@ -417,7 +413,8 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
if !name.is_token() || !value.is_field_value() {
|
if !name.is_token() || !value.is_field_value() {
|
||||||
return Err(Syntax); // Step 3, 4
|
return Err(Syntax); // Step 3, 4
|
||||||
}
|
}
|
||||||
let name_str = match name.to_lower().as_str() {
|
let name_lower = name.to_lower();
|
||||||
|
let name_str = match name_lower.as_str() {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
match s {
|
match s {
|
||||||
// Disallowed headers
|
// Disallowed headers
|
||||||
|
@ -431,48 +428,31 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
"upgrade" | "user-agent" | "via" => {
|
"upgrade" | "user-agent" | "via" => {
|
||||||
return Ok(()); // Step 5
|
return Ok(()); // Step 5
|
||||||
},
|
},
|
||||||
_ => String::from_str(s)
|
_ => s
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => return Err(Syntax)
|
None => return Err(Syntax)
|
||||||
};
|
};
|
||||||
let mut collection = self.request_headers.borrow_mut();
|
|
||||||
|
debug!("SetRequestHeader: name={}, value={}", name.as_str(), value.as_str());
|
||||||
|
let mut headers = self.request_headers.borrow_mut();
|
||||||
|
|
||||||
|
|
||||||
// Steps 6,7
|
// Steps 6,7
|
||||||
let old_header = collection.iter().find(|ref h| -> bool {
|
match headers.get_raw(name_str) {
|
||||||
// XXXManishearth following line waiting on the rust upgrade:
|
Some(raw) => {
|
||||||
ByteString::new(h.header_name().into_bytes()).eq_ignore_case(&value)
|
debug!("SetRequestHeader: old value = {}", raw[0]);
|
||||||
});
|
let mut buf = raw[0].clone();
|
||||||
match old_header {
|
buf.push_all(b", ");
|
||||||
Some(h) => {
|
buf.push_all(value.as_slice());
|
||||||
unsafe {
|
debug!("SetRequestHeader: new value = {}", buf);
|
||||||
// By step 4, the value is a subset of valid utf8
|
value = ByteString::new(buf);
|
||||||
// So this unsafe block should never fail
|
|
||||||
|
|
||||||
let mut buf = h.header_value();
|
|
||||||
buf.as_mut_vec().push_all(&[0x2C, 0x20]);
|
|
||||||
buf.as_mut_vec().push_all(value.as_slice());
|
|
||||||
value = ByteString::new(buf.into_bytes());
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut reader = BufReader::new(value.as_slice());
|
headers.set_raw(name_str.into_string(), vec![value.as_slice().to_vec()]);
|
||||||
let maybe_header: Option<Header> = HeaderEnum::value_from_stream(
|
|
||||||
name_str,
|
|
||||||
&mut HeaderValueByteIterator::new(&mut reader));
|
|
||||||
match maybe_header {
|
|
||||||
Some(h) => {
|
|
||||||
// Overwrites existing headers, which we want since we have
|
|
||||||
// prepended the new header value with the old one already
|
|
||||||
collection.insert(h);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
|
||||||
None => Err(Syntax)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fn Timeout(self) -> u32 {
|
fn Timeout(self) -> u32 {
|
||||||
self.timeout.get()
|
self.timeout.get()
|
||||||
|
@ -562,29 +542,37 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
load_data.data = extracted;
|
load_data.data = extracted;
|
||||||
|
|
||||||
// Default headers
|
// Default headers
|
||||||
let ref request_headers = self.request_headers;
|
{
|
||||||
if request_headers.borrow().content_type.is_none() {
|
#[inline]
|
||||||
let parameters = vec!((String::from_str("charset"), String::from_str("UTF-8")));
|
fn join_raw(a: &str, b: &str) -> Vec<u8> {
|
||||||
request_headers.borrow_mut().content_type = match data {
|
let len = a.len() + b.len();
|
||||||
|
let mut vec = Vec::with_capacity(len);
|
||||||
|
vec.push_all(a.as_bytes());
|
||||||
|
vec.push_all(b.as_bytes());
|
||||||
|
vec
|
||||||
|
}
|
||||||
|
let ref mut request_headers = self.request_headers.borrow_mut();
|
||||||
|
if !request_headers.has::<ContentType>() {
|
||||||
|
// XHR spec differs from http, and says UTF-8 should be in capitals,
|
||||||
|
// instead of "utf-8", which is what Hyper defaults to.
|
||||||
|
let params = ";charset=UTF-8";
|
||||||
|
let n = "content-type";
|
||||||
|
match data {
|
||||||
Some(eString(_)) =>
|
Some(eString(_)) =>
|
||||||
Some(MediaType {
|
request_headers.set_raw(n, vec![join_raw("text/plain", params)]),
|
||||||
type_: String::from_str("text"),
|
|
||||||
subtype: String::from_str("plain"),
|
|
||||||
parameters: parameters
|
|
||||||
}),
|
|
||||||
Some(eURLSearchParams(_)) =>
|
Some(eURLSearchParams(_)) =>
|
||||||
Some(MediaType {
|
request_headers.set_raw(
|
||||||
type_: String::from_str("application"),
|
n, vec![join_raw("application/x-www-form-urlencoded", params)]),
|
||||||
subtype: String::from_str("x-www-form-urlencoded"),
|
None => ()
|
||||||
parameters: parameters
|
|
||||||
}),
|
|
||||||
None => None
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if request_headers.borrow().accept.is_none() {
|
|
||||||
request_headers.borrow_mut().accept = Some(String::from_str("*/*"))
|
if !request_headers.has::<Accept>() {
|
||||||
|
request_headers.set(
|
||||||
|
Accept(vec![Mime(mime::TopStar, mime::SubStar, vec![])]));
|
||||||
}
|
}
|
||||||
|
} // drops the borrow_mut
|
||||||
|
|
||||||
load_data.headers = (*self.request_headers.borrow()).clone();
|
load_data.headers = (*self.request_headers.borrow()).clone();
|
||||||
load_data.method = (*self.request_method.borrow()).clone();
|
load_data.method = (*self.request_method.borrow()).clone();
|
||||||
|
@ -611,13 +599,15 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
buf.push_str(format!("{:u}", p).as_slice());
|
buf.push_str(format!("{:u}", p).as_slice());
|
||||||
});
|
});
|
||||||
referer_url.serialize_path().map(|ref h| buf.push_str(h.as_slice()));
|
referer_url.serialize_path().map(|ref h| buf.push_str(h.as_slice()));
|
||||||
self.request_headers.borrow_mut().referer = Some(buf);
|
self.request_headers.borrow_mut().set_raw("Referer".to_string(), vec![buf.into_bytes()]);
|
||||||
},
|
},
|
||||||
Ok(Some(ref req)) => self.insert_trusted_header("origin".to_string(),
|
Ok(Some(ref req)) => self.insert_trusted_header("origin".to_string(),
|
||||||
format!("{}", req.origin)),
|
format!("{}", req.origin)),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug!("request_headers = {}", *self.request_headers.borrow());
|
||||||
|
|
||||||
let gen_id = self.generation_id.get();
|
let gen_id = self.generation_id.get();
|
||||||
if self.sync.get() {
|
if self.sync.get() {
|
||||||
return XMLHttpRequest::fetch(&mut Sync(self), resource_task, load_data,
|
return XMLHttpRequest::fetch(&mut Sync(self), resource_task, load_data,
|
||||||
|
@ -678,22 +668,13 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
||||||
}
|
}
|
||||||
fn GetResponseHeader(self, name: ByteString) -> Option<ByteString> {
|
fn GetResponseHeader(self, name: ByteString) -> Option<ByteString> {
|
||||||
self.filter_response_headers().iter().find(|h| {
|
self.filter_response_headers().iter().find(|h| {
|
||||||
name.eq_ignore_case(&FromStr::from_str(h.header_name().as_slice()).unwrap())
|
name.eq_ignore_case(&FromStr::from_str(h.name()).unwrap())
|
||||||
}).map(|h| {
|
}).map(|h| {
|
||||||
// rust-http doesn't decode properly, we'll convert it back to bytes here
|
ByteString::new(h.value_string().into_bytes())
|
||||||
ByteString::new(h.header_value().as_slice().chars().map(|c| { assert!(c <= '\u00FF'); c as u8 }).collect())
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
fn GetAllResponseHeaders(self) -> ByteString {
|
fn GetAllResponseHeaders(self) -> ByteString {
|
||||||
let mut writer = MemWriter::new();
|
ByteString::new(self.filter_response_headers().to_string().into_bytes())
|
||||||
self.filter_response_headers().write_all(&mut writer).ok().expect("Writing response headers failed");
|
|
||||||
let mut vec = writer.unwrap();
|
|
||||||
|
|
||||||
// rust-http appends an extra "\r\n" when using write_all
|
|
||||||
vec.pop();
|
|
||||||
vec.pop();
|
|
||||||
|
|
||||||
ByteString::new(vec)
|
|
||||||
}
|
}
|
||||||
fn ResponseType(self) -> XMLHttpRequestResponseType {
|
fn ResponseType(self) -> XMLHttpRequestResponseType {
|
||||||
self.response_type.get()
|
self.response_type.get()
|
||||||
|
@ -797,7 +778,7 @@ trait PrivateXMLHttpRequestHelpers {
|
||||||
fn text_response(self) -> DOMString;
|
fn text_response(self) -> DOMString;
|
||||||
fn set_timeout(self, timeout:u32);
|
fn set_timeout(self, timeout:u32);
|
||||||
fn cancel_timeout(self);
|
fn cancel_timeout(self);
|
||||||
fn filter_response_headers(self) -> ResponseHeaderCollection;
|
fn filter_response_headers(self) -> Headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
||||||
|
@ -876,17 +857,12 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
||||||
// Part of step 13, send() (processing response)
|
// Part of step 13, send() (processing response)
|
||||||
// XXXManishearth handle errors, if any (substep 1)
|
// XXXManishearth handle errors, if any (substep 1)
|
||||||
// Substep 2
|
// Substep 2
|
||||||
let status_text = status.as_ref().map_or(vec![], |s| s.reason().into_bytes());
|
status.map(|RawStatus(code, reason)| {
|
||||||
let status_code = status.as_ref().map_or(0, |s| s.code());
|
self.status.set(code);
|
||||||
|
*self.status_text.borrow_mut() = ByteString::new(reason.into_bytes());
|
||||||
|
});
|
||||||
|
headers.as_ref().map(|h| *self.response_headers.borrow_mut() = h.clone());
|
||||||
|
|
||||||
*self.status_text.borrow_mut() = ByteString::new(status_text);
|
|
||||||
self.status.set(status_code);
|
|
||||||
match headers {
|
|
||||||
Some(ref h) => {
|
|
||||||
*self.response_headers.borrow_mut() = h.clone();
|
|
||||||
}
|
|
||||||
None => {}
|
|
||||||
};
|
|
||||||
// Substep 3
|
// Substep 3
|
||||||
if !self.sync.get() {
|
if !self.sync.get() {
|
||||||
self.change_ready_state(HeadersReceived);
|
self.change_ready_state(HeadersReceived);
|
||||||
|
@ -965,13 +941,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
||||||
fn insert_trusted_header(self, name: String, value: String) {
|
fn insert_trusted_header(self, name: String, value: String) {
|
||||||
// Insert a header without checking spec-compliance
|
// Insert a header without checking spec-compliance
|
||||||
// Use for hardcoded headers
|
// Use for hardcoded headers
|
||||||
let mut collection = self.request_headers.borrow_mut();
|
self.request_headers.borrow_mut().set_raw(name, vec![value.into_bytes()]);
|
||||||
let value_bytes = value.into_bytes();
|
|
||||||
let mut reader = BufReader::new(value_bytes.as_slice());
|
|
||||||
let maybe_header: Option<Header> = HeaderEnum::value_from_stream(
|
|
||||||
String::from_str(name.as_slice()),
|
|
||||||
&mut HeaderValueByteIterator::new(&mut reader));
|
|
||||||
collection.insert(maybe_header.unwrap());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dispatch_progress_event(self, upload: bool, type_: DOMString, loaded: u64, total: Option<u64>) {
|
fn dispatch_progress_event(self, upload: bool, type_: DOMString, loaded: u64, total: Option<u64>) {
|
||||||
|
@ -999,7 +969,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
||||||
|
|
||||||
fn dispatch_response_progress_event(self, type_: DOMString) {
|
fn dispatch_response_progress_event(self, type_: DOMString) {
|
||||||
let len = self.response.borrow().len() as u64;
|
let len = self.response.borrow().len() as u64;
|
||||||
let total = self.response_headers.borrow().content_length.map(|x| {x as u64});
|
let total = self.response_headers.borrow().get::<ContentLength>().map(|x| {x.len() as u64});
|
||||||
self.dispatch_progress_event(false, type_, len, total);
|
self.dispatch_progress_event(false, type_, len, total);
|
||||||
}
|
}
|
||||||
fn set_timeout(self, timeout: u32) {
|
fn set_timeout(self, timeout: u32) {
|
||||||
|
@ -1030,30 +1000,49 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
||||||
|
|
||||||
fn text_response(self) -> DOMString {
|
fn text_response(self) -> DOMString {
|
||||||
let mut encoding = UTF_8 as EncodingRef;
|
let mut encoding = UTF_8 as EncodingRef;
|
||||||
match self.response_headers.borrow().content_type {
|
match self.response_headers.borrow().get() {
|
||||||
Some(ref x) => {
|
Some(&ContentType(mime::Mime(_, _, ref params))) => {
|
||||||
for &(ref name, ref value) in x.parameters.iter() {
|
for &(ref name, ref value) in params.iter() {
|
||||||
if name.as_slice().eq_ignore_ascii_case("charset") {
|
if name == &mime::Charset {
|
||||||
encoding = encoding_from_whatwg_label(value.as_slice()).unwrap_or(encoding);
|
encoding = encoding_from_whatwg_label(value.to_string().as_slice()).unwrap_or(encoding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {}
|
None => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// According to Simon, decode() should never return an error, so unwrap()ing
|
// According to Simon, decode() should never return an error, so unwrap()ing
|
||||||
// the result should be fine. XXXManishearth have a closer look at this later
|
// the result should be fine. XXXManishearth have a closer look at this later
|
||||||
encoding.decode(self.response.borrow().as_slice(), DecodeReplace).unwrap().to_string()
|
encoding.decode(self.response.borrow().as_slice(), DecodeReplace).unwrap().to_string()
|
||||||
}
|
}
|
||||||
fn filter_response_headers(self) -> ResponseHeaderCollection {
|
fn filter_response_headers(self) -> Headers {
|
||||||
// http://fetch.spec.whatwg.org/#concept-response-header-list
|
// http://fetch.spec.whatwg.org/#concept-response-header-list
|
||||||
let mut headers = ResponseHeaderCollection::new();
|
use std::fmt;
|
||||||
for header in self.response_headers.borrow().iter() {
|
use hyper::header::{Header, HeaderFormat};
|
||||||
match header.header_name().as_slice().to_ascii_lower().as_slice() {
|
use hyper::header::common::SetCookie;
|
||||||
"set-cookie" | "set-cookie2" => {},
|
|
||||||
// XXXManishearth additional CORS filtering goes here
|
// a dummy header so we can use headers.remove::<SetCookie2>()
|
||||||
_ => headers.insert(header)
|
#[deriving(Clone)]
|
||||||
};
|
struct SetCookie2;
|
||||||
|
impl Header for SetCookie2 {
|
||||||
|
fn header_name(_: Option<SetCookie2>) -> &'static str {
|
||||||
|
"set-cookie2"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_header(_: &[Vec<u8>]) -> Option<SetCookie2> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
impl HeaderFormat for SetCookie2 {
|
||||||
|
fn fmt_header(&self, _f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut headers = self.response_headers.borrow().clone();
|
||||||
|
headers.remove::<SetCookie>();
|
||||||
|
headers.remove::<SetCookie2>();
|
||||||
|
// XXXManishearth additional CORS filtering goes here
|
||||||
headers
|
headers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ extern crate collections;
|
||||||
extern crate geom;
|
extern crate geom;
|
||||||
extern crate html5ever;
|
extern crate html5ever;
|
||||||
extern crate encoding;
|
extern crate encoding;
|
||||||
extern crate http;
|
extern crate hyper;
|
||||||
extern crate js;
|
extern crate js;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
extern crate msg;
|
extern crate msg;
|
||||||
|
|
|
@ -28,41 +28,58 @@ use servo_util::task_state;
|
||||||
use servo_util::task_state::IN_HTML_PARSER;
|
use servo_util::task_state::IN_HTML_PARSER;
|
||||||
use std::ascii::AsciiExt;
|
use std::ascii::AsciiExt;
|
||||||
use std::comm::channel;
|
use std::comm::channel;
|
||||||
|
use std::fmt::{mod, Show};
|
||||||
use std::str::MaybeOwned;
|
use std::str::MaybeOwned;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
use http::headers::HeaderEnum;
|
use time::{Tm, strptime};
|
||||||
use time;
|
|
||||||
use html5ever::Attribute;
|
use html5ever::Attribute;
|
||||||
use html5ever::tree_builder::{TreeSink, QuirksMode, NodeOrText, AppendNode, AppendText};
|
use html5ever::tree_builder::{TreeSink, QuirksMode, NodeOrText, AppendNode, AppendText};
|
||||||
use string_cache::QualName;
|
use string_cache::QualName;
|
||||||
|
use hyper::header::{Header, HeaderFormat};
|
||||||
|
use hyper::header::common::util as header_util;
|
||||||
|
|
||||||
pub enum HTMLInput {
|
pub enum HTMLInput {
|
||||||
InputString(String),
|
InputString(String),
|
||||||
InputUrl(Url),
|
InputUrl(Url),
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parses an RFC 2616 compliant date/time string, and returns a localized
|
//FIXME(seanmonstar): uplift to Hyper
|
||||||
// date/time string in a format suitable for document.lastModified.
|
#[deriving(Clone)]
|
||||||
fn parse_last_modified(timestamp: &str) -> String {
|
struct LastModified(pub Tm);
|
||||||
let format = "%m/%d/%Y %H:%M:%S";
|
|
||||||
|
|
||||||
// RFC 822, updated by RFC 1123
|
impl Header for LastModified {
|
||||||
match time::strptime(timestamp, "%a, %d %b %Y %T %Z") {
|
#[inline]
|
||||||
Ok(t) => return t.to_local().strftime(format).unwrap(),
|
fn header_name(_: Option<LastModified>) -> &'static str {
|
||||||
Err(_) => ()
|
"Last-Modified"
|
||||||
}
|
}
|
||||||
|
|
||||||
// RFC 850, obsoleted by RFC 1036
|
// Parses an RFC 2616 compliant date/time string,
|
||||||
match time::strptime(timestamp, "%A, %d-%b-%y %T %Z") {
|
fn parse_header(raw: &[Vec<u8>]) -> Option<LastModified> {
|
||||||
Ok(t) => return t.to_local().strftime(format).unwrap(),
|
header_util::from_one_raw_str(raw).and_then(|s: String| {
|
||||||
Err(_) => ()
|
let s = s.as_slice();
|
||||||
|
strptime(s, "%a, %d %b %Y %T %Z").or_else(|_| {
|
||||||
|
strptime(s, "%A, %d-%b-%y %T %Z")
|
||||||
|
}).or_else(|_| {
|
||||||
|
strptime(s, "%c")
|
||||||
|
}).ok().map(|tm| LastModified(tm))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ANSI C's asctime() format
|
impl HeaderFormat for LastModified {
|
||||||
match time::strptime(timestamp, "%c") {
|
// a localized date/time string in a format suitable
|
||||||
Ok(t) => t.to_local().strftime(format).unwrap(),
|
// for document.lastModified.
|
||||||
Err(_) => String::from_str("")
|
fn fmt_header(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
let LastModified(ref tm) = *self;
|
||||||
|
match tm.tm_gmtoff {
|
||||||
|
0 => tm.rfc822().fmt(f),
|
||||||
|
_ => tm.to_utc().rfc822().fmt(f)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn dom_last_modified(tm: &Tm) -> String {
|
||||||
|
tm.to_local().strftime("%m/%d/%Y %H:%M:%S").unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
trait SinkHelpers {
|
trait SinkHelpers {
|
||||||
|
@ -211,15 +228,9 @@ pub fn parse_html(page: &Page,
|
||||||
let load_response = input_port.recv();
|
let load_response = input_port.recv();
|
||||||
|
|
||||||
load_response.metadata.headers.as_ref().map(|headers| {
|
load_response.metadata.headers.as_ref().map(|headers| {
|
||||||
let header = headers.iter().find(|h|
|
headers.get().map(|&LastModified(ref tm)| {
|
||||||
h.header_name().as_slice().to_ascii_lower() == "last-modified".to_string()
|
document.set_last_modified(dom_last_modified(tm));
|
||||||
);
|
});
|
||||||
|
|
||||||
match header {
|
|
||||||
Some(h) => document.set_last_modified(
|
|
||||||
parse_last_modified(h.header_value().as_slice())),
|
|
||||||
None => {},
|
|
||||||
};
|
|
||||||
});
|
});
|
||||||
|
|
||||||
let base_url = load_response.metadata.final_url.clone();
|
let base_url = load_response.metadata.final_url.clone();
|
||||||
|
|
82
components/servo/Cargo.lock
generated
82
components/servo/Cargo.lock
generated
|
@ -87,6 +87,15 @@ dependencies = [
|
||||||
"util 0.0.1",
|
"util 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cookie"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/servo/cookie-rs#30520767a95b92e39265aaf6822db515b2418f1d"
|
||||||
|
dependencies = [
|
||||||
|
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl)",
|
||||||
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core_foundation"
|
name = "core_foundation"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -345,11 +354,16 @@ version = "0.0.0"
|
||||||
source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463652be835f498923653c"
|
source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463652be835f498923653c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "hyper"
|
||||||
version = "0.1.0-pre"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/rust-http?ref=servo#f957b94deb2c939c8e3d73d51823b65f8a1f8256"
|
source = "git+https://github.com/servo/hyper?ref=servo#dd9d1830f35f7a8371b1b3bcb2d3e9cf2763f33f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"openssl 0.0.0 (git+https://github.com/sfackler/rust-openssl.git)",
|
"cookie 0.0.1 (git+https://github.com/servo/cookie-rs)",
|
||||||
|
"mime 0.0.1 (git+https://github.com/hyperium/mime.rs)",
|
||||||
|
"move-acceptor 0.0.1 (git+https://github.com/reem/rust-move-acceptor)",
|
||||||
|
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl)",
|
||||||
|
"typeable 0.0.1 (git+https://github.com/reem/rust-typeable)",
|
||||||
|
"unsafe-any 0.1.0 (git+https://github.com/reem/rust-unsafe-any)",
|
||||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -427,6 +441,24 @@ name = "lazy_static"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
|
source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libressl-pnacl-sys"
|
||||||
|
version = "2.0.2"
|
||||||
|
source = "git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git#8e9349e0280b069bfab247a2202cd10b8beae154"
|
||||||
|
dependencies = [
|
||||||
|
"pnacl-build-helper 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mime"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/hyperium/mime.rs#5264e04655974f85c8d6581395cc24597266c653"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "move-acceptor"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/reem/rust-move-acceptor#25c5c33a83f605fdd0f3d37d2589e2b0b4e6cbd1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs-sys"
|
name = "mozjs-sys"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
@ -439,7 +471,7 @@ dependencies = [
|
||||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
|
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
|
||||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
|
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
|
||||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
|
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
|
||||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)",
|
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)",
|
||||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
|
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
|
||||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
|
@ -451,7 +483,7 @@ name = "net"
|
||||||
version = "0.0.1"
|
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)",
|
||||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
|
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
|
||||||
"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)",
|
||||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
|
@ -460,8 +492,20 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
version = "0.0.0"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/sfackler/rust-openssl.git#766ce4b7785c0b038bee95b74564e5b9bf7e9a4b"
|
source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896"
|
||||||
|
dependencies = [
|
||||||
|
"libressl-pnacl-sys 2.0.2 (git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git)",
|
||||||
|
"openssl-sys 0.0.1 (git+https://github.com/servo/rust-openssl)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-sys"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896"
|
||||||
|
dependencies = [
|
||||||
|
"pkg-config 0.1.0 (git+https://github.com/alexcrichton/pkg-config-rs)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf"
|
name = "phf"
|
||||||
|
@ -479,10 +523,20 @@ dependencies = [
|
||||||
"xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
|
"xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pkg-config"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/alexcrichton/pkg-config-rs#9b3b44a2e1a8ccc70c3f701aeb5154ad79e665e9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "plugins"
|
name = "plugins"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pnacl-build-helper"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "png"
|
name = "png"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -512,7 +566,7 @@ dependencies = [
|
||||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||||
"gfx 0.0.1",
|
"gfx 0.0.1",
|
||||||
"html5ever 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
|
"html5ever 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
|
||||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
|
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
|
||||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"net 0.0.1",
|
"net 0.0.1",
|
||||||
|
@ -596,6 +650,16 @@ dependencies = [
|
||||||
name = "task_info"
|
name = "task_info"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typeable"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/reem/rust-typeable#55154e1809db8ceec8f8519bdbb638c2fbd712f5"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unsafe-any"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/reem/rust-unsafe-any#2863af363bbd83079b6773920bba5b736408db33"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
@ -18,10 +18,21 @@ all: glut_app
|
||||||
ant debug
|
ant debug
|
||||||
|
|
||||||
.PHONY: glut_app
|
.PHONY: glut_app
|
||||||
glut_app:
|
glut_app: openssl
|
||||||
cd glut_app; \
|
cd glut_app; \
|
||||||
../../../mach cargo build --target=arm-linux-androideabi $(CARGO_OPTS)
|
OPENSSL_PATH=`pwd`/../openssl-1.0.1j ../../../mach cargo build --target=arm-linux-androideabi $(CARGO_OPTS)
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install:
|
install:
|
||||||
$(ANDROID_SDK)/platform-tools/adb install -r bin/ServoAndroid-debug.apk
|
$(ANDROID_SDK)/platform-tools/adb install -r bin/ServoAndroid-debug.apk
|
||||||
|
|
||||||
|
# From http://wiki.openssl.org/index.php/Android
|
||||||
|
.PHONY: openssl
|
||||||
|
openssl: openssl-1.0.1j/libssl.so
|
||||||
|
|
||||||
|
openssl-1.0.1j/libssl.so: openssl-1.0.1j/Configure
|
||||||
|
bash openssl.sh ${ANDROID_NDK}
|
||||||
|
|
||||||
|
openssl-1.0.1j/Configure:
|
||||||
|
wget https://www.openssl.org/source/openssl-1.0.1j.tar.gz
|
||||||
|
tar -zxvf openssl-1.0.1j.tar.gz
|
||||||
|
|
82
ports/android/glut_app/Cargo.lock
generated
82
ports/android/glut_app/Cargo.lock
generated
|
@ -67,6 +67,15 @@ dependencies = [
|
||||||
"util 0.0.1",
|
"util 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cookie"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/servo/cookie-rs#30520767a95b92e39265aaf6822db515b2418f1d"
|
||||||
|
dependencies = [
|
||||||
|
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl.git)",
|
||||||
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core_foundation"
|
name = "core_foundation"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -278,11 +287,16 @@ version = "0.0.0"
|
||||||
source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463652be835f498923653c"
|
source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463652be835f498923653c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "hyper"
|
||||||
version = "0.1.0-pre"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/rust-http?ref=servo#f957b94deb2c939c8e3d73d51823b65f8a1f8256"
|
source = "git+https://github.com/servo/hyper?ref=servo#dd9d1830f35f7a8371b1b3bcb2d3e9cf2763f33f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"openssl 0.0.0 (git+https://github.com/sfackler/rust-openssl.git)",
|
"cookie 0.0.1 (git+https://github.com/servo/cookie-rs)",
|
||||||
|
"mime 0.0.1 (git+https://github.com/hyperium/mime.rs)",
|
||||||
|
"move-acceptor 0.0.1 (git+https://github.com/reem/rust-move-acceptor)",
|
||||||
|
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl.git)",
|
||||||
|
"typeable 0.0.2 (git+https://github.com/reem/rust-typeable)",
|
||||||
|
"unsafe-any 0.1.1 (git+https://github.com/reem/rust-unsafe-any)",
|
||||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -360,6 +374,24 @@ name = "lazy_static"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
|
source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libressl-pnacl-sys"
|
||||||
|
version = "2.0.2"
|
||||||
|
source = "git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git#8e9349e0280b069bfab247a2202cd10b8beae154"
|
||||||
|
dependencies = [
|
||||||
|
"pnacl-build-helper 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mime"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/hyperium/mime.rs#5264e04655974f85c8d6581395cc24597266c653"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "move-acceptor"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/reem/rust-move-acceptor#25c5c33a83f605fdd0f3d37d2589e2b0b4e6cbd1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs-sys"
|
name = "mozjs-sys"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
@ -372,7 +404,7 @@ dependencies = [
|
||||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
|
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
|
||||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
|
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
|
||||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
|
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
|
||||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)",
|
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)",
|
||||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
|
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
|
||||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
|
@ -384,7 +416,7 @@ name = "net"
|
||||||
version = "0.0.1"
|
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)",
|
||||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
|
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
|
||||||
"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)",
|
||||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
|
@ -398,8 +430,20 @@ source = "git+https://github.com/servo/rust-opengles#7f025f0069fbf6fefef4ed383b9
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
version = "0.0.0"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/sfackler/rust-openssl.git#766ce4b7785c0b038bee95b74564e5b9bf7e9a4b"
|
source = "git+https://github.com/servo/rust-openssl.git#0a3cace0265fe286b505508aa6e5096fc94a6896"
|
||||||
|
dependencies = [
|
||||||
|
"libressl-pnacl-sys 2.0.2 (git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git)",
|
||||||
|
"openssl-sys 0.0.1 (git+https://github.com/servo/rust-openssl)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-sys"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896"
|
||||||
|
dependencies = [
|
||||||
|
"pkg-config 0.1.0 (git+https://github.com/alexcrichton/pkg-config-rs)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf"
|
name = "phf"
|
||||||
|
@ -417,10 +461,20 @@ dependencies = [
|
||||||
"xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
|
"xxhash 0.0.1 (git+https://github.com/Jurily/rust-xxhash)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pkg-config"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "git+https://github.com/alexcrichton/pkg-config-rs#9b3b44a2e1a8ccc70c3f701aeb5154ad79e665e9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "plugins"
|
name = "plugins"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pnacl-build-helper"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "png"
|
name = "png"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -450,7 +504,7 @@ dependencies = [
|
||||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||||
"gfx 0.0.1",
|
"gfx 0.0.1",
|
||||||
"html5ever 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
|
"html5ever 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
|
||||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
|
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
|
||||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"net 0.0.1",
|
"net 0.0.1",
|
||||||
|
@ -543,6 +597,16 @@ dependencies = [
|
||||||
name = "task_info"
|
name = "task_info"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typeable"
|
||||||
|
version = "0.0.2"
|
||||||
|
source = "git+https://github.com/reem/rust-typeable#2f240fb44ce2fcdbb2b890623bfb2afe18a67c05"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unsafe-any"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "git+https://github.com/reem/rust-unsafe-any#eb3fe87bea85f375b8fcefa0cdecfd131fae9624"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
188
ports/android/openssl.sh
Normal file
188
ports/android/openssl.sh
Normal file
|
@ -0,0 +1,188 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Cross-compile environment for Android on ARMv7 and x86
|
||||||
|
#
|
||||||
|
# Contents licensed under the terms of the OpenSSL license
|
||||||
|
# http://www.openssl.org/source/license.html
|
||||||
|
#
|
||||||
|
# See http://wiki.openssl.org/index.php/FIPS_Library_and_Android
|
||||||
|
# and http://wiki.openssl.org/index.php/Android
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
# Set ANDROID_NDK_ROOT to you NDK location. For example,
|
||||||
|
# /opt/android-ndk-r8e or /opt/android-ndk-r9. This can be done in a
|
||||||
|
# login script. If ANDROID_NDK_ROOT is not specified, the script will
|
||||||
|
# try to pick it up with the value of _ANDROID_NDK_ROOT below. If
|
||||||
|
# ANDROID_NDK_ROOT is set, then the value is ignored.
|
||||||
|
# _ANDROID_NDK="android-ndk-r8e"
|
||||||
|
_ANDROID_NDK="android-ndk-r9"
|
||||||
|
# _ANDROID_NDK="android-ndk-r10"
|
||||||
|
|
||||||
|
# Set _ANDROID_EABI to the EABI you want to use. You can find the
|
||||||
|
# list in $ANDROID_NDK_ROOT/toolchains. This value is always used.
|
||||||
|
# _ANDROID_EABI="x86-4.6"
|
||||||
|
# _ANDROID_EABI="arm-linux-androideabi-4.6"
|
||||||
|
_ANDROID_EABI="arm-linux-androideabi-4.8"
|
||||||
|
|
||||||
|
# Set _ANDROID_ARCH to the architecture you are building for.
|
||||||
|
# This value is always used.
|
||||||
|
# _ANDROID_ARCH=arch-x86
|
||||||
|
_ANDROID_ARCH=arch-arm
|
||||||
|
|
||||||
|
# Set _ANDROID_API to the API you want to use. You should set it
|
||||||
|
# to one of: android-14, android-9, android-8, android-14, android-5
|
||||||
|
# android-4, or android-3. You can't set it to the latest (for
|
||||||
|
# example, API-17) because the NDK does not supply the platform. At
|
||||||
|
# Android 5.0, there will likely be another platform added (android-22?).
|
||||||
|
# This value is always used.
|
||||||
|
# _ANDROID_API="android-14"
|
||||||
|
_ANDROID_API="android-18"
|
||||||
|
# _ANDROID_API="android-19"
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
# If the user did not specify the NDK location, try and pick it up.
|
||||||
|
# We expect something like ANDROID_NDK_ROOT=/opt/android-ndk-r8e
|
||||||
|
# or ANDROID_NDK_ROOT=/usr/local/android-ndk-r8e.
|
||||||
|
export ANDROID_NDK_ROOT=$1
|
||||||
|
echo $ANDROID_NDK_ROOT
|
||||||
|
# Error checking
|
||||||
|
# ANDROID_NDK_ROOT should always be set by the user (even when not running this script)
|
||||||
|
# http://groups.google.com/group/android-ndk/browse_thread/thread/a998e139aca71d77
|
||||||
|
if [ -z "$ANDROID_NDK_ROOT" ] || [ ! -d "$ANDROID_NDK_ROOT" ]; then
|
||||||
|
echo "Error: ANDROID_NDK_ROOT is not a valid path. Please edit this script."
|
||||||
|
# echo "$ANDROID_NDK_ROOT"
|
||||||
|
# exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Error checking
|
||||||
|
if [ ! -d "$ANDROID_NDK_ROOT/toolchains" ]; then
|
||||||
|
echo "Error: ANDROID_NDK_ROOT/toolchains is not a valid path. Please edit this script."
|
||||||
|
# echo "$ANDROID_NDK_ROOT/toolchains"
|
||||||
|
# exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Error checking
|
||||||
|
if [ ! -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI" ]; then
|
||||||
|
echo "Error: ANDROID_EABI is not a valid path. Please edit this script."
|
||||||
|
# echo "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI"
|
||||||
|
# exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
# Based on ANDROID_NDK_ROOT, try and pick up the required toolchain. We expect something like:
|
||||||
|
# /opt/android-ndk-r83/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin
|
||||||
|
# Once we locate the toolchain, we add it to the PATH. Note: this is the 'hard way' of
|
||||||
|
# doing things according to the NDK documentation for Ice Cream Sandwich.
|
||||||
|
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
||||||
|
|
||||||
|
ANDROID_TOOLCHAIN=""
|
||||||
|
for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86"
|
||||||
|
do
|
||||||
|
if [ -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin" ]; then
|
||||||
|
ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Error checking
|
||||||
|
if [ -z "$ANDROID_TOOLCHAIN" ] || [ ! -d "$ANDROID_TOOLCHAIN" ]; then
|
||||||
|
echo "Error: ANDROID_TOOLCHAIN is not valid. Please edit this script."
|
||||||
|
# echo "$ANDROID_TOOLCHAIN"
|
||||||
|
# exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $_ANDROID_ARCH in
|
||||||
|
arch-arm)
|
||||||
|
ANDROID_TOOLS="arm-linux-androideabi-gcc arm-linux-androideabi-ranlib arm-linux-androideabi-ld"
|
||||||
|
;;
|
||||||
|
arch-x86)
|
||||||
|
ANDROID_TOOLS="i686-linux-android-gcc i686-linux-android-ranlib i686-linux-android-ld"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "ERROR ERROR ERROR"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
for tool in $ANDROID_TOOLS
|
||||||
|
do
|
||||||
|
# Error checking
|
||||||
|
if [ ! -e "$ANDROID_TOOLCHAIN/$tool" ]; then
|
||||||
|
echo "Error: Failed to find $tool. Please edit this script."
|
||||||
|
# echo "$ANDROID_TOOLCHAIN/$tool"
|
||||||
|
# exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Only modify/export PATH if ANDROID_TOOLCHAIN good
|
||||||
|
if [ ! -z "$ANDROID_TOOLCHAIN" ]; then
|
||||||
|
export ANDROID_TOOLCHAIN="$ANDROID_TOOLCHAIN"
|
||||||
|
export PATH="$ANDROID_TOOLCHAIN":"$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
# For the Android SYSROOT. Can be used on the command line with --sysroot
|
||||||
|
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
||||||
|
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
|
||||||
|
export SYSROOT="$ANDROID_SYSROOT"
|
||||||
|
export NDK_SYSROOT="$ANDROID_SYSROOT"
|
||||||
|
|
||||||
|
# Error checking
|
||||||
|
if [ -z "$ANDROID_SYSROOT" ] || [ ! -d "$ANDROID_SYSROOT" ]; then
|
||||||
|
echo "Error: ANDROID_SYSROOT is not valid. Please edit this script."
|
||||||
|
# echo "$ANDROID_SYSROOT"
|
||||||
|
# exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
# Most of these should be OK (MACHINE, SYSTEM, ARCH). RELEASE is ignored.
|
||||||
|
export MACHINE=armv7
|
||||||
|
export RELEASE=2.6.37
|
||||||
|
export SYSTEM=android
|
||||||
|
export ARCH=arm
|
||||||
|
export CROSS_COMPILE="arm-linux-androideabi-"
|
||||||
|
|
||||||
|
if [ "$_ANDROID_ARCH" == "arch-x86" ]; then
|
||||||
|
export MACHINE=i686
|
||||||
|
export RELEASE=2.6.37
|
||||||
|
export SYSTEM=android
|
||||||
|
export ARCH=x86
|
||||||
|
export CROSS_COMPILE="i686-linux-android-"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For the Android toolchain
|
||||||
|
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
|
||||||
|
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
|
||||||
|
export SYSROOT="$ANDROID_SYSROOT"
|
||||||
|
export NDK_SYSROOT="$ANDROID_SYSROOT"
|
||||||
|
export ANDROID_NDK_SYSROOT="$ANDROID_SYSROOT"
|
||||||
|
export ANDROID_API="$_ANDROID_API"
|
||||||
|
|
||||||
|
# CROSS_COMPILE and ANDROID_DEV are DFW (Don't Fiddle With). Its used by OpenSSL build system.
|
||||||
|
# export CROSS_COMPILE="arm-linux-androideabi-"
|
||||||
|
export ANDROID_DEV="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr"
|
||||||
|
export HOSTCC=gcc
|
||||||
|
|
||||||
|
VERBOSE=1
|
||||||
|
if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" != "0" ]; then
|
||||||
|
echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
|
||||||
|
echo "ANDROID_ARCH: $_ANDROID_ARCH"
|
||||||
|
echo "ANDROID_EABI: $_ANDROID_EABI"
|
||||||
|
echo "ANDROID_API: $ANDROID_API"
|
||||||
|
echo "ANDROID_SYSROOT: $ANDROID_SYSROOT"
|
||||||
|
echo "ANDROID_TOOLCHAIN: $ANDROID_TOOLCHAIN"
|
||||||
|
echo "FIPS_SIG: $FIPS_SIG"
|
||||||
|
echo "CROSS_COMPILE: $CROSS_COMPILE"
|
||||||
|
echo "ANDROID_DEV: $ANDROID_DEV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd openssl-1.0.1j
|
||||||
|
perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
|
||||||
|
./config shared -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine --openssldir=/usr/local/ssl/$ANDROID_API
|
||||||
|
make depend
|
||||||
|
make all
|
64
ports/cef/Cargo.lock
generated
64
ports/cef/Cargo.lock
generated
|
@ -78,6 +78,15 @@ dependencies = [
|
||||||
"util 0.0.1",
|
"util 0.0.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cookie"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/servo/cookie-rs#9b579dd9b8cf0624eee1d013e9b48577acd3c40e"
|
||||||
|
dependencies = [
|
||||||
|
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl.git)",
|
||||||
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "core_foundation"
|
name = "core_foundation"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -309,11 +318,16 @@ version = "0.0.0"
|
||||||
source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463652be835f498923653c"
|
source = "git+https://github.com/servo/html5ever?ref=servo#87c7e8b710391338b2463652be835f498923653c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "http"
|
name = "hyper"
|
||||||
version = "0.1.0-pre"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/servo/rust-http?ref=servo#f957b94deb2c939c8e3d73d51823b65f8a1f8256"
|
source = "git+https://github.com/servo/hyper?ref=servo#dd9d1830f35f7a8371b1b3bcb2d3e9cf2763f33f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"openssl 0.0.0 (git+https://github.com/sfackler/rust-openssl.git)",
|
"cookie 0.0.1 (git+https://github.com/servo/cookie-rs)",
|
||||||
|
"mime 0.0.1 (git+https://github.com/hyperium/mime.rs)",
|
||||||
|
"move-acceptor 0.0.1 (git+https://github.com/reem/rust-move-acceptor)",
|
||||||
|
"openssl 0.0.1 (git+https://github.com/servo/rust-openssl.git)",
|
||||||
|
"typeable 0.0.2 (git+https://github.com/reem/rust-typeable)",
|
||||||
|
"unsafe-any 0.1.1 (git+https://github.com/reem/rust-unsafe-any)",
|
||||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -391,6 +405,16 @@ name = "lazy_static"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
|
source = "git+https://github.com/Kimundi/lazy-static.rs#62976cb611c5396e11315ae64c9c389576240eb7"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "mime"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/hyperium/mime.rs#5264e04655974f85c8d6581395cc24597266c653"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "move-acceptor"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/reem/rust-move-acceptor#25c5c33a83f605fdd0f3d37d2589e2b0b4e6cbd1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs-sys"
|
name = "mozjs-sys"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
@ -403,7 +427,7 @@ dependencies = [
|
||||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
|
"azure 0.1.0 (git+https://github.com/servo/rust-azure)",
|
||||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
|
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
|
||||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
|
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
|
||||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)",
|
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface)",
|
||||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
|
"layers 0.1.0 (git+https://github.com/servo/rust-layers)",
|
||||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
|
@ -415,7 +439,7 @@ name = "net"
|
||||||
version = "0.0.1"
|
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)",
|
||||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
|
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
|
||||||
"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)",
|
||||||
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
"url 0.1.0 (git+https://github.com/servo/rust-url)",
|
||||||
|
@ -424,8 +448,20 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
version = "0.0.0"
|
version = "0.0.1"
|
||||||
source = "git+https://github.com/sfackler/rust-openssl.git#766ce4b7785c0b038bee95b74564e5b9bf7e9a4b"
|
source = "git+https://github.com/servo/rust-openssl.git#0a3cace0265fe286b505508aa6e5096fc94a6896"
|
||||||
|
dependencies = [
|
||||||
|
"libressl-pnacl-sys 2.0.2 (git+https://github.com/DiamondLovesYou/libressl-pnacl-sys.git)",
|
||||||
|
"openssl-sys 0.0.1 (git+https://github.com/servo/rust-openssl)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "openssl-sys"
|
||||||
|
version = "0.0.1"
|
||||||
|
source = "git+https://github.com/servo/rust-openssl#0a3cace0265fe286b505508aa6e5096fc94a6896"
|
||||||
|
dependencies = [
|
||||||
|
"pkg-config 0.1.0 (git+https://github.com/alexcrichton/pkg-config-rs)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "phf"
|
name = "phf"
|
||||||
|
@ -476,7 +512,7 @@ dependencies = [
|
||||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
|
||||||
"gfx 0.0.1",
|
"gfx 0.0.1",
|
||||||
"html5ever 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
|
"html5ever 0.0.0 (git+https://github.com/servo/html5ever?ref=servo)",
|
||||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo)",
|
"hyper 0.0.1 (git+https://github.com/servo/hyper?ref=servo)",
|
||||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
"js 0.1.0 (git+https://github.com/servo/rust-mozjs)",
|
||||||
"msg 0.0.1",
|
"msg 0.0.1",
|
||||||
"net 0.0.1",
|
"net 0.0.1",
|
||||||
|
@ -575,6 +611,16 @@ dependencies = [
|
||||||
name = "task_info"
|
name = "task_info"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typeable"
|
||||||
|
version = "0.0.2"
|
||||||
|
source = "git+https://github.com/reem/rust-typeable#2f240fb44ce2fcdbb2b890623bfb2afe18a67c05"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "unsafe-any"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "git+https://github.com/reem/rust-unsafe-any#eb3fe87bea85f375b8fcefa0cdecfd131fae9624"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "url"
|
name = "url"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
|
@ -3,12 +3,6 @@
|
||||||
[XMLHttpRequest: send() - charset parameter of Content-Type]
|
[XMLHttpRequest: send() - charset parameter of Content-Type]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[XMLHttpRequest: send() - charset parameter of Content-Type 1]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: send() - charset parameter of Content-Type 2]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: send() - charset parameter of Content-Type 3]
|
[XMLHttpRequest: send() - charset parameter of Content-Type 3]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[send-entity-body-none.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: send(null) - no entity body]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[send-redirect-infinite-sync.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: send() - Redirects (infinite loop; sync) (301)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[send-redirect-infinite.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: send() - Redirects (infinite loop)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
[send-redirect.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: send() - Redirects (basics) (301)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: send() - Redirects (basics) (302)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: send() - Redirects (basics) (303)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: send() - Redirects (basics) (307)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[setrequestheader-case-insensitive.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that differ in case]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
[setrequestheader-header-allowed.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that are allowed (Authorization)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that are allowed (Pragma)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Transfer-Encoding)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that are allowed (Content-Type)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that are allowed (Overwrite)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that are allowed (If)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that are allowed (Status-URI)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: setRequestHeader() - headers that are allowed (X-Pink-Unicorn)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
[status-async.htm]
|
[status-async.htm]
|
||||||
type: testharness
|
type: testharness
|
||||||
[XMLHttpRequest: status/statusText - various responses 7 (GET 402)]
|
expected: TIMEOUT
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: status/statusText - various responses 9 (CHICKEN 402)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,3 @@
|
||||||
[status-basic.htm]
|
[status-basic.htm]
|
||||||
type: testharness
|
type: testharness
|
||||||
[XMLHttpRequest: status/statusText - various responses 7 (GET 402)]
|
expected: TIMEOUT
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: status/statusText - various responses 9 (CHICKEN 402)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
|
|
14
tests/wpt/metadata/XMLHttpRequest/status-error.htm.ini
Normal file
14
tests/wpt/metadata/XMLHttpRequest/status-error.htm.ini
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[status-error.htm]
|
||||||
|
type: testharness
|
||||||
|
[XMLHttpRequest: status error handling GET 699]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[XMLHttpRequest: status error handling HEAD 699]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[XMLHttpRequest: status error handling POST 699]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[XMLHttpRequest: status error handling PUT 699]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[xmlhttprequest-network-error-sync.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: members during network errors (sync)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[xmlhttprequest-network-error.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: members during network errors]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
[redirect.html]
|
[redirect.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: TIMEOUT
|
|
||||||
[location with a worker in separate file that redirects]
|
[location with a worker in separate file that redirects]
|
||||||
expected: TIMEOUT
|
expected: FAIL
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue