Auto merge of #15868 - servo:hyper, r=jdm

Update Hyper and OpenSSL

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15868)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-03-31 11:46:09 -05:00 committed by GitHub
commit 82b0d5ad54
70 changed files with 645 additions and 486 deletions

View file

@ -34,7 +34,7 @@ bluetooth_traits = {path = "../bluetooth_traits"}
byteorder = "1.0"
canvas_traits = {path = "../canvas_traits"}
caseless = "0.1.0"
cookie = "0.2.5"
cookie = "0.6"
cssparser = "0.12"
deny_public_fields = {path = "../deny_public_fields"}
devtools_traits = {path = "../devtools_traits"}
@ -48,8 +48,8 @@ heapsize = "0.3.6"
heapsize_derive = "0.1"
html5ever = {version = "0.14", features = ["heap_size", "unstable"]}
html5ever-atoms = {version = "0.2", features = ["heap_size"]}
hyper = "0.9.9"
hyper_serde = "0.5"
hyper = "0.10"
hyper_serde = "0.6"
image = "0.12"
ipc-channel = "0.7"
js = {git = "https://github.com/servo/rust-mozjs", features = ["promises"]}

View file

@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cookie_rs;
use core::nonzero::NonZero;
use devtools_traits::ScriptToDevtoolsControlMsg;
use document_loader::{DocumentLoader, LoadType};
@ -3285,15 +3286,15 @@ impl DocumentMethods for Document {
return Err(Error::Security);
}
let header = Header::parse_header(&[cookie.into()]);
if let Ok(SetCookie(cookies)) = header {
let cookies = cookies.into_iter().map(Serde).collect();
if let Ok(cookie_header) = SetCookie::parse_header(&vec![cookie.to_string().into_bytes()]) {
let cookies = cookie_header.0.into_iter().filter_map(|cookie| {
cookie_rs::Cookie::parse(cookie).ok().map(Serde)
}).collect();
let _ = self.window
.upcast::<GlobalScope>()
.resource_threads()
.send(SetCookiesForUrl(self.url(), cookies, NonHTTP));
.upcast::<GlobalScope>()
.resource_threads()
.send(SetCookiesForUrl(self.url(), cookies, NonHTTP));
}
Ok(())
}

View file

@ -182,9 +182,9 @@ pub fn handle_get_active_element(documents: &Documents,
pub fn handle_get_cookies(documents: &Documents,
pipeline: PipelineId,
reply: IpcSender<Vec<Serde<Cookie>>>) {
reply: IpcSender<Vec<Serde<Cookie<'static>>>>) {
// TODO: Return an error if the pipeline doesn't exist?
let cookies: Vec<Serde<Cookie>> = match documents.find_document(pipeline) {
let cookies = match documents.find_document(pipeline) {
None => Vec::new(),
Some(document) => {
let url = document.url();
@ -202,9 +202,9 @@ pub fn handle_get_cookies(documents: &Documents,
pub fn handle_get_cookie(documents: &Documents,
pipeline: PipelineId,
name: String,
reply: IpcSender<Vec<Serde<Cookie>>>) {
reply: IpcSender<Vec<Serde<Cookie<'static>>>>) {
// TODO: Return an error if the pipeline doesn't exist?
let cookies: Vec<Serde<Cookie>> = match documents.find_document(pipeline) {
let cookies = match documents.find_document(pipeline) {
None => Vec::new(),
Some(document) => {
let url = document.url();
@ -215,13 +215,13 @@ pub fn handle_get_cookie(documents: &Documents,
receiver.recv().unwrap()
},
};
reply.send(cookies.into_iter().filter(|c| c.name == &*name).collect()).unwrap();
reply.send(cookies.into_iter().filter(|c| c.name() == &*name).collect()).unwrap();
}
// https://w3c.github.io/webdriver/webdriver-spec.html#add-cookie
pub fn handle_add_cookie(documents: &Documents,
pipeline: PipelineId,
cookie: Cookie,
cookie: Cookie<'static>,
reply: IpcSender<Result<(), WebDriverCookieError>>) {
// TODO: Return a different error if the pipeline doesn't exist?
let document = match documents.find_document(pipeline) {
@ -229,22 +229,24 @@ pub fn handle_add_cookie(documents: &Documents,
None => return reply.send(Err(WebDriverCookieError::UnableToSetCookie)).unwrap(),
};
let url = document.url();
let method = if cookie.httponly {
let method = if cookie.http_only() {
HTTP
} else {
NonHTTP
};
reply.send(match (document.is_cookie_averse(), cookie.domain.clone()) {
let domain = cookie.domain().map(ToOwned::to_owned);
reply.send(match (document.is_cookie_averse(), domain) {
(true, _) => Err(WebDriverCookieError::InvalidDomain),
(false, Some(ref domain)) if url.host_str().map(|x| { x == &**domain }).unwrap_or(false) => {
(false, Some(ref domain)) if url.host_str().map(|x| { x == domain }).unwrap_or(false) => {
let _ = document.window().upcast::<GlobalScope>().resource_threads().send(
SetCookieForUrl(url, cookie, method)
SetCookieForUrl(url, Serde(cookie), method)
);
Ok(())
},
(false, None) => {
let _ = document.window().upcast::<GlobalScope>().resource_threads().send(
SetCookieForUrl(url, cookie, method)
SetCookieForUrl(url, Serde(cookie), method)
);
Ok(())
},