servo: Merge #15868 - Update Hyper and OpenSSL (from servo:hyper); r=jdm

Source-Repo: https://github.com/servo/servo
Source-Revision: 82b0d5ad54d94a29f595d59cbb37dcbab5d5a5c8

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : cda703ae221b029588bdb549a69b150e1397ca3a
This commit is contained in:
ddh 2017-03-31 11:46:09 -05:00
Родитель 093a9fef3a
Коммит b6b120e23d
32 изменённых файлов: 330 добавлений и 453 удалений

208
servo/Cargo.lock сгенерированный
Просмотреть файл

@ -51,6 +51,11 @@ name = "ansi_term"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "antidote"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "app_units"
version = "0.4.0"
@ -468,13 +473,10 @@ dependencies = [
[[package]]
name = "cookie"
version = "0.2.5"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -615,8 +617,8 @@ version = "0.0.1"
dependencies = [
"devtools_traits 0.0.1",
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -633,8 +635,8 @@ dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -877,6 +879,11 @@ dependencies = [
"miniz-sys 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "foreign-types"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "freetype"
version = "0.2.0"
@ -1130,14 +1137,6 @@ dependencies = [
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hpack"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "html5ever"
version = "0.14.1"
@ -1174,33 +1173,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hyper"
version = "0.9.18"
version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
"solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
"traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hyper_serde"
version = "0.5.1"
name = "hyper-openssl"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "hyper_serde"
version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1475,14 +1481,6 @@ dependencies = [
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libressl-pnacl-sys"
version = "2.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libservo"
version = "0.0.1"
@ -1682,11 +1680,12 @@ version = "0.0.1"
dependencies = [
"base64 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"brotli 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"flate2 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-openssl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"immeta 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1695,13 +1694,12 @@ dependencies = [
"mime_guess 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"net_traits 0.0.1",
"openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
"profile_traits 0.0.1",
"serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 0.9.9 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-websocket 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)",
"servo-websocket 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
"servo_config 0.0.1",
"servo_url 0.0.1",
"threadpool 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1729,11 +1727,12 @@ dependencies = [
name = "net_tests"
version = "0.0.1"
dependencies = [
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"flate2 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-openssl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"net 0.0.1",
@ -1750,11 +1749,11 @@ dependencies = [
name = "net_traits"
version = "0.0.1"
dependencies = [
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
"immeta 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1762,7 +1761,6 @@ dependencies = [
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"num-traits 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"parse-hosts 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 0.9.11 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1894,45 +1892,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "openssl"
version = "0.7.14"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
"foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "openssl-sys"
version = "0.7.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "openssl-sys-extras"
version = "0.7.14"
version = "0.9.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "openssl-verify"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -2047,14 +2026,6 @@ dependencies = [
"script_plugins 0.0.1",
]
[[package]]
name = "pnacl-build-helper"
version = "1.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "png"
version = "0.6.2"
@ -2259,7 +2230,7 @@ dependencies = [
"canvas_traits 0.0.1",
"caseless 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"cmake 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"deny_public_fields 0.0.1",
"devtools_traits 0.0.1",
@ -2273,8 +2244,8 @@ dependencies = [
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever-atoms 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"js 0.1.4 (git+https://github.com/servo/rust-mozjs)",
@ -2368,14 +2339,14 @@ dependencies = [
"app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bluetooth_traits 0.0.1",
"canvas_traits 0.0.1",
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"devtools_traits 0.0.1",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"heapsize 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -2549,14 +2520,14 @@ dependencies = [
[[package]]
name = "servo-websocket"
version = "0.18.0"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.27 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
"unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2697,15 +2668,6 @@ name = "smallvec"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "solicit"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "string_cache"
version = "0.4.0"
@ -2922,14 +2884,6 @@ dependencies = [
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tempdir"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "tendril"
version = "0.2.3"
@ -3015,7 +2969,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "traitobject"
version = "0.0.1"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@ -3153,12 +3107,12 @@ dependencies = [
[[package]]
name = "webdriver"
version = "0.20.0"
version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"backtrace 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3170,9 +3124,9 @@ name = "webdriver_server"
version = "0.0.1"
dependencies = [
"base64 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3185,7 +3139,7 @@ dependencies = [
"servo_url 0.0.1",
"url 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"uuid 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"webdriver 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
"webdriver 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@ -3341,6 +3295,7 @@ dependencies = [
"checksum android_injected_glue 0.2.2 (git+https://github.com/mmatyas/android-rs-injected-glue)" = "<none>"
"checksum angle 0.1.2 (git+https://github.com/servo/angle?branch=servo)" = "<none>"
"checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6"
"checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5"
"checksum app_units 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a0c3b5be4ed53affe3e1a162b2e7ef9979bcaac80daa9026e9d7988c41e0e83"
"checksum arrayvec 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d89f1b0e242270b5b797778af0c8d182a1a2ccac5d8d6fadf414223cc0fab096"
"checksum aster 0.38.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c9b49e42a449c0b79d8acb91db37621de0978064dca7d3288ddcf030123e5b3"
@ -3374,7 +3329,7 @@ dependencies = [
"checksum cocoa 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a5d0bcb4d345adf9b4ada6c5bb3e2b87c8150b79c46f3f26446de5f4d48de4b"
"checksum color_quant 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a475fc4af42d83d28adf72968d9bcfaf035a1a9381642d8e85d8a04957767b0d"
"checksum compiletest_rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f3f344389765ad7bec166f64c1b39ed6dd2b54d81c4c5dd8af789169351d380c"
"checksum cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0e3d6405328b6edb412158b3b7710e2634e23f3614b9bb1c412df7952489a626"
"checksum cookie 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce776927cd64cbe74ebd1d9b375edb9d1b6bfa808618ddf9548645e019ebdfbb"
"checksum core-foundation 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f51ce3b8ebe311c56de14231eb57572c15abebd2d32b3bcb99bcdb9c101f5ac3"
"checksum core-foundation-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "41115a6aa5d3e1e5ef98148373f25971d1fad53818553f216495f9e67e90a624"
"checksum core-graphics 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ead017dcf77f503dc991f6b52de6084eeea60a94b0a652baa9bf88654a28e83f"
@ -3410,6 +3365,7 @@ dependencies = [
"checksum flate2 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "d4e4d0c15ef829cbc1b7cda651746be19cceeb238be7b1049227b14891df9e25"
"checksum fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6cc484842f1e2884faf56f529f960cc12ad8c71ce96cc7abba0a067c98fee344"
"checksum fontsan 0.3.2 (git+https://github.com/servo/fontsan)" = "<none>"
"checksum foreign-types 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e4056b9bd47f8ac5ba12be771f77a0dae796d1bbaaf5fd0b9c2d38b69b8a29d"
"checksum freetype 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fde23272c687e4570aefec06cb71174ec0f5284b725deac4e77ba2665d635faf"
"checksum futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "51f93f3de6ba1794dcd5810b3546d004600a59a98266487c8407bc4b24e398f3"
"checksum gamma-lut 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "cd8728df930776135895cbb25cbdd17791cde7d4285d53cf58fe6ee2e6412455"
@ -3427,12 +3383,12 @@ dependencies = [
"checksum heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "46f96d52fb1564059fc97b85ef6165728cc30198ab60073bf114c66c4c89bb5d"
"checksum heartbeats-simple 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad003ce233955e9d95f2c69cde84e68302ba9ba4a673d351c9bff93c738aadc"
"checksum heartbeats-simple-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e1a408c0011427cc0e0049f7861c70377819aedfc006e8c901b1c70fd98fb1a4"
"checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58"
"checksum html5ever 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c28216b1b9d20ef7407d8d633a3c1c4ec9a529ee661184aac0a03876709bd6b8"
"checksum html5ever-atoms 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9bd86e3b6a5a7933a272cc0a854f24e371f31576e585c0b41e8f857270c5134"
"checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d"
"checksum hyper 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)" = "1b9bf64f730d6ee4b0528a5f0a316363da9d8104318731509d4ccc86248f82b3"
"checksum hyper_serde 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d602a93073c250f49b2e2d931cc1755a5f447824154dc3c711716dee29bd7486"
"checksum hyper 0.10.5 (registry+https://github.com/rust-lang/crates.io-index)" = "43a15e3273b2133aaac0150478ab443fb89f15c3de41d8d93d8f3bb14bf560f6"
"checksum hyper-openssl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "5ac3d814565b8a91446678e6c472f9889c99b0ec12c92279e46fc2530f017c35"
"checksum hyper_serde 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a43d985c58afed6b59991932e1d9b5f2629472849f0062c0078d82fdc0b788bb"
"checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11"
"checksum image 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "979bad0502082fd60053a490282e87d6c89650942e3a270e0d4c83569c7f5899"
"checksum immeta 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0b9260463a221bfe3f02100c56e2d14c050d5ffe7e44a43d0a1b2b1f2b523502"
@ -3452,7 +3408,6 @@ dependencies = [
"checksum leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40a8225d44241fd324a8af2806ba635fc7c8a7e9a7de4d5cf3ef54e71f5926fc"
"checksum libc 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "88ee81885f9f04bff991e306fea7c1c60a5f0f9e409e99f6b40e3311a3363135"
"checksum libloading 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fd1835a714c1f67ba073a493493c23686a480e2614e208c921834808b1f19d8f"
"checksum libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "cbc058951ab6a3ef35ca16462d7642c4867e6403520811f28537a4e2f2db3e71"
"checksum libz-sys 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e5ee912a45d686d393d5ac87fac15ba0ba18daae14e8e7543c63ebf7fb7e970c"
"checksum log 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5141eca02775a762cc6cd564d8d2c50f67c0ea3a372cbf1c51592b3e029e10ad"
"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084"
@ -3484,10 +3439,8 @@ dependencies = [
"checksum ogg 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "013b78ceb7fb82555a2f8a95d8e40866fe64a5d15b83c51b3e1fdd40cd903ed3"
"checksum ogg_metadata 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1753e64956b3afd900f788bf6d2e9d0986df39168be86f4b47ec2058d0c2f7"
"checksum open 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3478ed1686bd1300c8a981a940abc92b06fac9cbef747f4c668d4e032ff7b842"
"checksum openssl 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "c4117b6244aac42ed0150a6019b4d953d28247c5dd6ae6f46ae469b5f2318733"
"checksum openssl-sys 0.7.17 (registry+https://github.com/rust-lang/crates.io-index)" = "89c47ee94c352eea9ddaf8e364be7f978a3bb6d66d73176572484238dd5a5c3f"
"checksum openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "11c5e1dba7d3d03d80f045bf0d60111dc69213b67651e7c889527a3badabb9fa"
"checksum openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed86cce894f6b0ed4572e21eb34026f1dc8869cb9ee3869029131bc8c3feb2d"
"checksum openssl 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d8aa0eb7aad44f0da6f7dda13ddb4559d91a0f40cfab150b1f76ad5b39ec523f"
"checksum openssl-sys 0.9.10 (registry+https://github.com/rust-lang/crates.io-index)" = "14f5bfd12054d764510b887152d564ba11d99ae24ea7d740781778f646620576"
"checksum ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "da12c96037889ae0be29dd2bdd260e5a62a7df24e6466d5a15bb8131c1c200a8"
"checksum osmesa-src 12.0.1 (git+https://github.com/servo/osmesa-src)" = "<none>"
"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b"
@ -3501,7 +3454,6 @@ dependencies = [
"checksum phf_generator 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "6b07ffcc532ccc85e3afc45865469bf5d9e4ef5bfcf9622e3cfe80c2d275ec03"
"checksum phf_shared 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)" = "07e24b0ca9643bdecd0632f2b3da6b1b89bbb0030e0b992afc1113b23a7bc2f2"
"checksum pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3a8b4c6b8165cd1a1cd4b9b120978131389f64bdaf456435caa41e630edba903"
"checksum pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "61c9231d31aea845007443d62fcbb58bb6949ab9c18081ee1e09920e0cf1118b"
"checksum png 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3cb773e9a557edb568ce9935cf783e3cdcabe06a9449d41b3e5506d88e582c82"
"checksum procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9f566249236c6ca4340f7ca78968271f0ed2b0f234007a61b66f9ecd0af09260"
"checksum quasi 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dcbf815446dc6a0afbc72d88f9a8aa71b608d10b168e09437c80c0fd6fd410c9"
@ -3531,7 +3483,7 @@ dependencies = [
"checksum servo-freetype-sys 4.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9232032c2e85118c0282c6562c84cab12316e655491ba0a5d1905b2320060d1b"
"checksum servo-glutin 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17f541bd4b5a709d5133349e731379c6d74c3946f3b509d4fa8204f1833f9067"
"checksum servo-skia 0.30000004.1 (registry+https://github.com/rust-lang/crates.io-index)" = "22ba980da523e91b9d2f7da9fb35f721138a1e604b8d8191e56f403e4760a9e4"
"checksum servo-websocket 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a7445fde9aacb9a1f493652ab02ac0fb7a8bfe1e6cd762f7bd44b839a5d5e4c"
"checksum servo-websocket 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8a1ff13c5d852c2793805226e688044309f2c1d8f063784805a13e99cb75b611"
"checksum sha1 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cc30b1e1e8c40c121ca33b86c23308a090d19974ef001b4bf6e61fd1a0fb095c"
"checksum shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fb04126b6fcfd2710fb5b6d18f4207b6c535f2850a7e1a43bcd526d44f30a79a"
"checksum shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72f20b8f3c060374edb8046591ba28f62448c369ccbdc7b02075103fb3a9e38d"
@ -3541,7 +3493,6 @@ dependencies = [
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
"checksum smallvec 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dca03f2f42500a9ef8ac0d16183dff8bed40e3dcf98f9d4147928548d5c4236e"
"checksum solicit 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "172382bac9424588d7840732b250faeeef88942e37b6e35317dce98cafdd75b2"
"checksum string_cache 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c19dbe4d2552673a8c4ec0e91523670ee2b73ba3560d935703ce5d64a40f864c"
"checksum string_cache_codegen 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0c9dfe1a7c8bba1ecb90730d269fdc08afe93d23c28dd6c4aa5cabd79a05a05e"
"checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc"
@ -3554,7 +3505,6 @@ dependencies = [
"checksum syntex_pos 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8df3921c7945dfb9ffc53aa35adb2cf4313b5ab5f079c3619b3d4eb82a0efc2b"
"checksum syntex_syntax 0.54.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc960085bae44591e22d01f6c0e82a8aec832f8659aca556cdf8ecbdac2bb47b"
"checksum target_build_utils 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f42dc058080c19c6a58bdd1bf962904ee4f5ef1fe2a81b529f31dacc750c679f"
"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
"checksum tendril 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cebf864c2d90394a1b66d6fe45963f9a177f2af81a0edea5060f77627f9c4587"
"checksum term 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d168af3930b369cfe245132550579d47dfd873d69470755a19c2c6568dbbd989"
"checksum term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "07b6c1ac5b3fffd75073276bca1ceed01f67a28537097a2a9539e116e50fb21a"
@ -3565,7 +3515,7 @@ dependencies = [
"checksum time 0.1.36 (registry+https://github.com/rust-lang/crates.io-index)" = "211b63c112206356ef1ff9b19355f43740fc3f85960c598a93d3a3d3ba7beade"
"checksum tinyfiledialogs 2.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d401358cd71aca93d5f4fccd3db5b87d970ae70fe457911929d99f4a87f7531"
"checksum toml 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "736b60249cb25337bc196faa43ee12c705e426f3d55c214d73a4e7be06f92cb4"
"checksum traitobject 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "07eaeb7689bb7fca7ce15628319635758eda769fed481ecfe6686ddef2600616"
"checksum traitobject 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "efd1f82c56340fdf16f2a953d7bda4f8fdffba13d93b00844c25572110b26079"
"checksum truetype 0.26.0 (registry+https://github.com/rust-lang/crates.io-index)" = "acec30350633d6dac9dc1a625786b6cbe9150664be941aac2c35ad7199eab877"
"checksum typeable 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1410f6f91f21d1612654e7cc69193b0334f909dcf2c790c4826254fbb86f8887"
"checksum unicase 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "13a5906ca2b98c799f4b1ab4557b76367ebd6ae5ef14930ec841c74aed5f3764"
@ -3585,7 +3535,7 @@ dependencies = [
"checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f"
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
"checksum walkdir 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff"
"checksum webdriver 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cdc28802daddee94267a657ffeac2593a33881fb7a3a44fedd320b1319efcaf6"
"checksum webdriver 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d548aabf87411b1b4ba91fd07eacd8b238135c7131a452b8a9f6386209167e18"
"checksum webrender 0.26.0 (git+https://github.com/servo/webrender)" = "<none>"
"checksum webrender_traits 0.27.0 (git+https://github.com/servo/webrender)" = "<none>"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"

Просмотреть файл

@ -12,8 +12,8 @@ path = "lib.rs"
[dependencies]
devtools_traits = {path = "../devtools_traits"}
encoding = "0.2"
hyper = "0.9.9"
hyper_serde = "0.5"
hyper = "0.10"
hyper_serde = "0.6"
ipc-channel = "0.7"
log = "0.3.5"
msg = {path = "../msg"}

Просмотреть файл

@ -13,8 +13,8 @@ path = "lib.rs"
bitflags = "0.7"
heapsize = "0.3.0"
heapsize_derive = "0.1"
hyper = "0.9.9"
hyper_serde = "0.5"
hyper = "0.10"
hyper_serde = "0.6"
ipc-channel = "0.7"
msg = {path = "../msg"}
serde = "0.9"

Просмотреть файл

@ -12,11 +12,12 @@ path = "lib.rs"
[dependencies]
base64 = "0.4.1"
brotli = "1.0.6"
cookie = "0.2.5"
cookie = "0.6"
devtools_traits = {path = "../devtools_traits"}
flate2 = "0.2.0"
hyper = "0.9.9"
hyper_serde = "0.5"
hyper = "0.10"
hyper_serde = "0.6"
hyper-openssl = "0.2.2"
immeta = "0.3.1"
ipc-channel = "0.7"
log = "0.3.5"
@ -25,15 +26,14 @@ mime = "0.2.1"
mime_guess = "1.8.0"
msg = {path = "../msg"}
net_traits = {path = "../net_traits"}
openssl = "0.7.6"
openssl-verify = "0.1"
openssl = "0.9"
profile_traits = {path = "../profile_traits"}
serde = "0.9"
serde_derive = "0.9"
serde_json = "0.9"
servo_config = {path = "../config"}
servo_url = {path = "../url"}
servo-websocket = "0.18"
servo-websocket = "0.19"
threadpool = "1.0"
time = "0.1.17"
unicase = "1.4.0"

Просмотреть файл

@ -2,14 +2,15 @@
* 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 hyper;
use hyper::client::Pool;
use hyper::net::{HttpStream, HttpsConnector, SslClient};
use openssl::ssl::{SSL_OP_NO_COMPRESSION, SSL_OP_NO_SSLV2, SSL_OP_NO_SSLV3, SSL_VERIFY_PEER};
use openssl::ssl::{Ssl, SslContext, SslMethod, SslStream};
use hyper_openssl;
use openssl::ssl::{SSL_OP_NO_COMPRESSION, SSL_OP_NO_SSLV2, SSL_OP_NO_SSLV3};
use openssl::ssl::{SslConnectorBuilder, SslMethod};
use servo_config::resource_files::resources_dir_path;
use std::sync::Arc;
pub type Connector = HttpsConnector<ServoSslClient>;
pub type Connector = hyper::net::HttpsConnector<hyper_openssl::OpensslClient>;
// The basic logic here is to prefer ciphers with ECDSA certificates, Forward
// Secrecy, AES GCM ciphers, AES ciphers, and finally 3DES ciphers.
@ -27,38 +28,21 @@ const DEFAULT_CIPHERS: &'static str = concat!(
"AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA"
);
pub fn create_ssl_context(certificate_file: &str) -> Arc<SslContext> {
let mut context = SslContext::new(SslMethod::Sslv23).unwrap();
context.set_CA_file(&resources_dir_path()
.expect("Need certificate file to make network requests")
.join(certificate_file)).unwrap();
context.set_cipher_list(DEFAULT_CIPHERS).unwrap();
context.set_options(SSL_OP_NO_SSLV2 | SSL_OP_NO_SSLV3 | SSL_OP_NO_COMPRESSION);
Arc::new(context)
}
pub fn create_http_connector(certificate_file: &str) -> Arc<Pool<Connector>> {
let ca_file = &resources_dir_path()
.expect("Need certificate file to make network requests")
.join(certificate_file);
pub fn create_http_connector(ssl_context: Arc<SslContext>) -> Arc<Pool<Connector>> {
let connector = HttpsConnector::new(ServoSslClient {
context: ssl_context,
});
Arc::new(Pool::with_connector(Default::default(), connector))
}
pub struct ServoSslClient {
context: Arc<SslContext>,
}
impl SslClient for ServoSslClient {
type Stream = SslStream<HttpStream>;
fn wrap_client(&self, stream: HttpStream, host: &str) -> Result<Self::Stream, ::hyper::Error> {
let mut ssl = try!(Ssl::new(&self.context));
try!(ssl.set_hostname(host));
let host = host.to_owned();
ssl.set_verify_callback(SSL_VERIFY_PEER, move |p, x| {
::openssl_verify::verify_callback(&host, p, x)
});
SslStream::connect(ssl, stream).map_err(From::from)
let mut ssl_connector_builder = SslConnectorBuilder::new(SslMethod::tls()).unwrap();
{
let context = ssl_connector_builder.builder_mut();
context.set_ca_file(ca_file).expect("could not set CA file");
context.set_cipher_list(DEFAULT_CIPHERS).expect("could not set ciphers");
context.set_options(SSL_OP_NO_SSLV2 | SSL_OP_NO_SSLV3 | SSL_OP_NO_COMPRESSION);
}
let ssl_connector = ssl_connector_builder.build();
let ssl_client = hyper_openssl::OpensslClient::from(ssl_connector);
let https_connector = hyper::net::HttpsConnector::new(ssl_client);
Arc::new(Pool::with_connector(Default::default(), https_connector))
}

Просмотреть файл

@ -21,7 +21,7 @@ use time::{Tm, now, at, Duration};
pub struct Cookie {
#[serde(deserialize_with = "hyper_serde::deserialize",
serialize_with = "hyper_serde::serialize")]
pub cookie: cookie_rs::Cookie,
pub cookie: cookie_rs::Cookie<'static>,
pub host_only: bool,
pub persistent: bool,
#[serde(deserialize_with = "hyper_serde::deserialize",
@ -34,27 +34,35 @@ pub struct Cookie {
}
impl Cookie {
pub fn from_cookie_string(cookie_str: String, request: &ServoUrl,
source: CookieSource) -> Option<Cookie> {
cookie_rs::Cookie::parse(cookie_str)
.ok()
.map(|cookie| Cookie::new_wrapped(cookie, request, source))
.unwrap_or(None)
}
/// http://tools.ietf.org/html/rfc6265#section-5.3
pub fn new_wrapped(mut cookie: cookie_rs::Cookie, request: &ServoUrl, source: CookieSource)
pub fn new_wrapped(mut cookie: cookie_rs::Cookie<'static>, request: &ServoUrl, source: CookieSource)
-> Option<Cookie> {
// Step 3
let (persistent, expiry_time) = match (&cookie.max_age, &cookie.expires) {
(&Some(max_age), _) => {
(true, Some(at(now().to_timespec() + Duration::seconds(max_age as i64))))
let (persistent, expiry_time) = match (cookie.max_age(), cookie.expires()) {
(Some(max_age), _) => {
(true, Some(at(now().to_timespec() + Duration::seconds(max_age.num_seconds()))))
}
(_, &Some(expires)) => (true, Some(expires)),
(_, Some(expires)) => (true, Some(expires)),
_ => (false, None)
};
let url_host = request.host_str().unwrap_or("").to_owned();
// Step 4
let mut domain = cookie.domain.clone().unwrap_or("".to_owned());
let mut domain = cookie.domain().unwrap_or("").to_owned();
// Step 5
if is_pub_domain(&domain) {
if domain == url_host {
domain = "".to_owned();
domain = "".to_string();
} else {
return None
}
@ -65,24 +73,24 @@ impl Cookie {
if !Cookie::domain_match(&url_host, &domain) {
return None;
} else {
cookie.domain = Some(domain);
cookie.set_domain(domain);
false
}
} else {
cookie.domain = Some(url_host);
cookie.set_domain(url_host);
true
};
// Step 7
let mut path = cookie.path.unwrap_or("".to_owned());
let mut path = cookie.path().unwrap_or("").to_owned();
if path.chars().next() != Some('/') {
path = Cookie::default_path(request.path()).to_owned();
path = Cookie::default_path(&request.path().to_owned()).to_string();
}
cookie.path = Some(path);
cookie.set_path(path);
// Step 10
if cookie.httponly && source == CookieSource::NonHTTP {
if cookie.http_only() && source == CookieSource::NonHTTP {
return None;
}
@ -139,8 +147,9 @@ impl Cookie {
// http://tools.ietf.org/html/rfc6265#section-5.1.3
pub fn domain_match(string: &str, domain_string: &str) -> bool {
debug_assert!(string.to_lowercase() == string);
debug_assert!(domain_string.to_lowercase() == domain_string);
let string = &string.to_lowercase();
let domain_string = &domain_string.to_lowercase();
string == domain_string ||
(string.ends_with(domain_string) &&
string.as_bytes()[string.len()-domain_string.len()-1] == b'.' &&
@ -152,27 +161,27 @@ impl Cookie {
pub fn appropriate_for_url(&self, url: &ServoUrl, source: CookieSource) -> bool {
let domain = url.host_str();
if self.host_only {
if self.cookie.domain.as_ref().map(String::as_str) != domain {
if self.cookie.domain() != domain {
return false;
}
} else {
if let (Some(domain), &Some(ref cookie_domain)) = (domain, &self.cookie.domain) {
if let (Some(domain), &Some(ref cookie_domain)) = (domain, &self.cookie.domain()) {
if !Cookie::domain_match(domain, cookie_domain) {
return false;
}
}
}
if let Some(ref cookie_path) = self.cookie.path {
if let Some(ref cookie_path) = self.cookie.path() {
if !Cookie::path_match(url.path(), cookie_path) {
return false;
}
}
if self.cookie.secure && !url.is_secure_scheme() {
if self.cookie.secure() && !url.is_secure_scheme() {
return false;
}
if self.cookie.httponly && source == CookieSource::NonHTTP {
if self.cookie.http_only() && source == CookieSource::NonHTTP {
return false;
}

Просмотреть файл

@ -34,20 +34,20 @@ impl CookieStorage {
// http://tools.ietf.org/html/rfc6265#section-5.3
pub fn remove(&mut self, cookie: &Cookie, url: &ServoUrl, source: CookieSource) -> Result<Option<Cookie>, ()> {
let domain = reg_host(cookie.cookie.domain.as_ref().unwrap_or(&"".to_string()));
let domain = reg_host(cookie.cookie.domain().as_ref().unwrap_or(&""));
let cookies = self.cookies_map.entry(domain).or_insert(vec![]);
// https://www.ietf.org/id/draft-ietf-httpbis-cookie-alone-01.txt Step 2
if !cookie.cookie.secure && !url.is_secure_scheme() {
let new_domain = cookie.cookie.domain.as_ref().unwrap();
let new_path = cookie.cookie.path.as_ref().unwrap();
if !cookie.cookie.secure() && !url.is_secure_scheme() {
let new_domain = cookie.cookie.domain().as_ref().unwrap().to_owned();
let new_path = cookie.cookie.path().as_ref().unwrap().to_owned();
let any_overlapping = cookies.iter().any(|c| {
let existing_domain = c.cookie.domain.as_ref().unwrap();
let existing_path = c.cookie.path.as_ref().unwrap();
let existing_domain = c.cookie.domain().as_ref().unwrap().to_owned();
let existing_path = c.cookie.path().as_ref().unwrap().to_owned();
c.cookie.name == cookie.cookie.name &&
c.cookie.secure &&
c.cookie.name() == cookie.cookie.name() &&
c.cookie.secure() &&
(Cookie::domain_match(new_domain, existing_domain) ||
Cookie::domain_match(existing_domain, new_domain)) &&
Cookie::path_match(new_path, existing_path)
@ -60,9 +60,9 @@ impl CookieStorage {
// Step 11.1
let position = cookies.iter().position(|c| {
c.cookie.domain == cookie.cookie.domain &&
c.cookie.path == cookie.cookie.path &&
c.cookie.name == cookie.cookie.name
c.cookie.domain() == cookie.cookie.domain() &&
c.cookie.path() == cookie.cookie.path() &&
c.cookie.name() == cookie.cookie.name()
});
if let Some(ind) = position {
@ -70,7 +70,7 @@ impl CookieStorage {
let c = cookies.remove(ind);
// http://tools.ietf.org/html/rfc6265#section-5.3 step 11.2
if c.cookie.httponly && source == CookieSource::NonHTTP {
if c.cookie.http_only() && source == CookieSource::NonHTTP {
// Undo the removal.
cookies.push(c);
Err(())
@ -85,7 +85,7 @@ impl CookieStorage {
// http://tools.ietf.org/html/rfc6265#section-5.3
pub fn push(&mut self, mut cookie: Cookie, url: &ServoUrl, source: CookieSource) {
// https://www.ietf.org/id/draft-ietf-httpbis-cookie-alone-01.txt Step 1
if cookie.cookie.secure && !url.is_secure_scheme() {
if cookie.cookie.secure() && !url.is_secure_scheme() {
return;
}
@ -102,7 +102,7 @@ impl CookieStorage {
}
// Step 12
let domain = reg_host(&cookie.cookie.domain.as_ref().unwrap_or(&"".to_string()));
let domain = reg_host(&cookie.cookie.domain().as_ref().unwrap_or(&""));
let mut cookies = self.cookies_map.entry(domain).or_insert(vec![]);
if cookies.len() == self.max_per_host {
@ -111,7 +111,7 @@ impl CookieStorage {
let new_len = cookies.len();
// https://www.ietf.org/id/draft-ietf-httpbis-cookie-alone-01.txt
if new_len == old_len && !evict_one_cookie(cookie.cookie.secure, cookies) {
if new_len == old_len && !evict_one_cookie(cookie.cookie.secure(), cookies) {
return;
}
}
@ -119,8 +119,8 @@ impl CookieStorage {
}
pub fn cookie_comparator(a: &Cookie, b: &Cookie) -> Ordering {
let a_path_len = a.cookie.path.as_ref().map_or(0, |p| p.len());
let b_path_len = b.cookie.path.as_ref().map_or(0, |p| p.len());
let a_path_len = a.cookie.path().as_ref().map_or(0, |p| p.len());
let b_path_len = b.cookie.path().as_ref().map_or(0, |p| p.len());
match a_path_len.cmp(&b_path_len) {
Ordering::Equal => {
let a_creation_time = a.creation_time.to_timespec();
@ -137,10 +137,10 @@ impl CookieStorage {
pub fn cookies_for_url(&mut self, url: &ServoUrl, source: CookieSource) -> Option<String> {
let filterer = |c: &&mut Cookie| -> bool {
info!(" === SENT COOKIE : {} {} {:?} {:?}",
c.cookie.name,
c.cookie.value,
c.cookie.domain,
c.cookie.path);
c.cookie.name(),
c.cookie.value(),
c.cookie.domain(),
c.cookie.path());
info!(" === SENT COOKIE RESULT {}",
c.appropriate_for_url(url, source));
// Step 1
@ -161,7 +161,7 @@ impl CookieStorage {
(match acc.len() {
0 => acc,
_ => acc + "; ",
}) + &c.cookie.name + "=" + &c.cookie.value
}) + &c.cookie.name() + "=" + &c.cookie.value()
};
let result = url_cookies.iter_mut().fold("".to_owned(), reducer);
@ -175,7 +175,7 @@ impl CookieStorage {
pub fn cookies_data_for_url<'a>(&'a mut self,
url: &'a ServoUrl,
source: CookieSource)
-> Box<Iterator<Item = cookie_rs::Cookie> + 'a> {
-> Box<Iterator<Item = cookie_rs::Cookie<'static>> + 'a> {
let domain = reg_host(url.host_str().unwrap_or(""));
let cookies = self.cookies_map.entry(domain).or_insert(vec![]);
@ -187,7 +187,7 @@ impl CookieStorage {
}
fn reg_host<'a>(url: &'a str) -> String {
reg_suffix(url).to_string()
reg_suffix(url).to_lowercase()
}
fn is_cookie_expired(cookie: &Cookie) -> bool {
@ -219,7 +219,7 @@ fn evict_one_cookie(is_secure_cookie: bool, cookies: &mut Vec<Cookie>) -> bool {
fn get_oldest_accessed(is_secure_cookie: bool, cookies: &mut Vec<Cookie>) -> Option<(usize, Tm)> {
let mut oldest_accessed: Option<(usize, Tm)> = None;
for (i, c) in cookies.iter().enumerate() {
if (c.cookie.secure == is_secure_cookie) &&
if (c.cookie.secure() == is_secure_cookie) &&
oldest_accessed.as_ref().map_or(true, |a| c.last_access < a.1) {
oldest_accessed = Some((i, c.last_access));
}

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use brotli::Decompressor;
use connector::{Connector, create_http_connector, create_ssl_context};
use connector::{Connector, create_http_connector};
use cookie;
use cookie_storage::CookieStorage;
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg, HttpRequest as DevtoolsHttpRequest};
@ -27,6 +27,7 @@ use hyper::header::Origin as HyperOrigin;
use hyper::method::Method;
use hyper::net::{Fresh, HttpStream, HttpsStream, NetworkConnector};
use hyper::status::StatusCode;
use hyper_openssl::SslStream;
use hyper_serde::Serde;
use log;
use msg::constellation_msg::PipelineId;
@ -35,7 +36,6 @@ use net_traits::hosts::replace_host;
use net_traits::request::{CacheMode, CredentialsMode, Destination, Origin};
use net_traits::request::{RedirectMode, Referrer, Request, RequestMode, ResponseTainting};
use net_traits::response::{HttpsState, Response, ResponseBody, ResponseType};
use openssl::ssl::SslStream;
use resource_thread::AuthCache;
use servo_url::{ImmutableOrigin, ServoUrl};
use std::collections::HashSet;
@ -75,12 +75,11 @@ pub struct HttpState {
impl HttpState {
pub fn new(certificate_path: &str) -> HttpState {
let ssl_context = create_ssl_context(certificate_path);
HttpState {
hsts_list: Arc::new(RwLock::new(HstsList::new())),
cookie_jar: Arc::new(RwLock::new(CookieStorage::new(150))),
auth_cache: Arc::new(RwLock::new(AuthCache::new())),
connector_pool: create_http_connector(ssl_context),
connector_pool: create_http_connector(certificate_path),
}
}
}
@ -258,8 +257,8 @@ fn set_cookie_for_url(cookie_jar: &Arc<RwLock<CookieStorage>>,
let header = Header::parse_header(&[cookie_val.into_bytes()]);
if let Ok(SetCookie(cookies)) = header {
for bare_cookie in cookies {
if let Some(cookie) = cookie::Cookie::new_wrapped(bare_cookie, request, source) {
for cookie in cookies {
if let Some(cookie) = cookie::Cookie::from_cookie_string(cookie, request, source) {
cookie_jar.push(cookie, request, source);
}
}

Просмотреть файл

@ -12,6 +12,7 @@ extern crate cookie as cookie_rs;
extern crate devtools_traits;
extern crate flate2;
extern crate hyper;
extern crate hyper_openssl;
extern crate hyper_serde;
extern crate immeta;
extern crate ipc_channel;
@ -23,7 +24,6 @@ extern crate mime_guess;
extern crate msg;
extern crate net_traits;
extern crate openssl;
extern crate openssl_verify;
extern crate profile_traits;
extern crate serde;
#[macro_use]

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A thread that takes a URL and streams back the binary data.
use connector::{Connector, create_http_connector, create_ssl_context};
use connector::{Connector, create_http_connector};
use cookie;
use cookie_rs;
use cookie_storage::CookieStorage;
@ -21,7 +21,6 @@ use net_traits::{CustomResponseMediator, ResourceId};
use net_traits::{ResourceThreads, WebSocketCommunicate, WebSocketConnectData};
use net_traits::request::{Request, RequestInit};
use net_traits::storage_thread::StorageThreadMsg;
use openssl::ssl::SslContext;
use profile_traits::time::ProfilerChan;
use serde::{Deserialize, Serialize};
use serde_json;
@ -47,7 +46,6 @@ pub struct ResourceGroup {
cookie_jar: Arc<RwLock<CookieStorage>>,
auth_cache: Arc<RwLock<AuthCache>>,
hsts_list: Arc<RwLock<HstsList>>,
ssl_context: Arc<SslContext>,
connector: Arc<Pool<Connector>>,
}
@ -106,20 +104,17 @@ fn create_resource_groups(config_dir: Option<&Path>)
read_json_from_file(&mut hsts_list, config_dir, "hsts_list.json");
read_json_from_file(&mut cookie_jar, config_dir, "cookie_jar.json");
}
let ssl_context = create_ssl_context("certs");
let resource_group = ResourceGroup {
cookie_jar: Arc::new(RwLock::new(cookie_jar)),
auth_cache: Arc::new(RwLock::new(auth_cache)),
hsts_list: Arc::new(RwLock::new(hsts_list.clone())),
ssl_context: ssl_context.clone(),
connector: create_http_connector(ssl_context.clone()),
connector: create_http_connector("certs"),
};
let private_resource_group = ResourceGroup {
cookie_jar: Arc::new(RwLock::new(CookieStorage::new(150))),
auth_cache: Arc::new(RwLock::new(AuthCache::new())),
hsts_list: Arc::new(RwLock::new(HstsList::new())),
ssl_context: ssl_context.clone(),
connector: create_http_connector(ssl_context),
connector: create_http_connector("certs"),
};
(resource_group, private_resource_group)
}
@ -153,6 +148,7 @@ impl ResourceChannelManager {
}
}
/// Returns false if the thread should exit.
fn process_msg(&mut self,
msg: CoreResourceMsg,
@ -163,10 +159,10 @@ impl ResourceChannelManager {
CoreResourceMsg::WebsocketConnect(connect, connect_data) =>
self.resource_manager.websocket_connect(connect, connect_data, group),
CoreResourceMsg::SetCookieForUrl(request, cookie, source) =>
self.resource_manager.set_cookie_for_url(&request, cookie, source, group),
self.resource_manager.set_cookie_for_url(&request, cookie.into_inner(), source, group),
CoreResourceMsg::SetCookiesForUrl(request, cookies, source) => {
for cookie in cookies {
self.resource_manager.set_cookie_for_url(&request, cookie.0, source, group);
self.resource_manager.set_cookie_for_url(&request, cookie.into_inner(), source, group);
}
}
CoreResourceMsg::GetCookiesForUrl(url, consumer, source) => {
@ -312,9 +308,11 @@ impl CoreResourceManager {
}
}
fn set_cookie_for_url(&mut self, request: &ServoUrl, cookie: cookie_rs::Cookie, source: CookieSource,
fn set_cookie_for_url(&mut self, request: &ServoUrl,
cookie: cookie_rs::Cookie<'static>,
source: CookieSource,
resource_group: &ResourceGroup) {
if let Some(cookie) = cookie::Cookie::new_wrapped(cookie, &request, source) {
if let Some(cookie) = cookie::Cookie::new_wrapped(cookie, request, source) {
let mut cookie_jar = resource_group.cookie_jar.write().unwrap();
cookie_jar.push(cookie, request, source)
}
@ -329,7 +327,7 @@ impl CoreResourceManager {
cookie_jar: group.cookie_jar.clone(),
auth_cache: group.auth_cache.clone(),
// FIXME(#15694): use group.connector.clone() instead.
connector_pool: create_http_connector(group.ssl_context.clone()),
connector_pool: create_http_connector("certs"),
};
let ua = self.user_agent.clone();
let dc = self.devtools_chan.clone();
@ -357,7 +355,6 @@ impl CoreResourceManager {
resource_grp: &ResourceGroup) {
websocket_loader::init(connect,
connect_data,
resource_grp.cookie_jar.clone(),
resource_grp.ssl_context.clone());
resource_grp.cookie_jar.clone());
}
}

Просмотреть файл

@ -4,7 +4,7 @@
use base64;
use net_traits::response::{Response, ResponseBody, ResponseType};
use openssl::crypto::hash::{hash, Type as MessageDigest};
use openssl::hash::{MessageDigest, hash};
use std::iter::Filter;
use std::str::Split;
use std::sync::MutexGuard;
@ -119,7 +119,7 @@ fn apply_algorithm_to_response(body: MutexGuard<ResponseBody>,
message_digest: MessageDigest)
-> String {
if let ResponseBody::Done(ref vec) = *body {
let response_digest = hash(message_digest, vec);
let response_digest = hash(message_digest, vec).unwrap();
base64::encode(&response_digest)
} else {
unreachable!("Tried to calculate digest of incomplete response body")
@ -156,9 +156,9 @@ pub fn is_response_integrity_valid(integrity_metadata: &str, response: &Response
let digest = item.val;
let message_digest = match &*algorithm {
"sha256" => MessageDigest::SHA256,
"sha384" => MessageDigest::SHA384,
"sha512" => MessageDigest::SHA512,
"sha256" => MessageDigest::sha256(),
"sha384" => MessageDigest::sha384(),
"sha512" => MessageDigest::sha512(),
_ => continue,
};

Просмотреть файл

@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cookie::Cookie;
use cookie_rs;
use cookie_storage::CookieStorage;
use fetch::methods::{should_be_blocked_due_to_bad_port, should_be_blocked_due_to_nosniff};
use http_loader::{is_redirect_status, set_request_cookies};
@ -11,14 +12,13 @@ use hyper::header::{Accept, CacheControl, CacheDirective, Connection, Connection
use hyper::header::{Headers, Host, SetCookie, Pragma, Protocol, ProtocolName, Upgrade};
use hyper::http::h1::{LINE_ENDING, parse_response};
use hyper::method::Method;
use hyper::net::{HttpStream, HttpsStream};
use hyper::net::HttpStream;
use hyper::status::StatusCode;
use hyper::version::HttpVersion;
use net_traits::{CookieSource, MessageData, NetworkError, WebSocketCommunicate, WebSocketConnectData};
use net_traits::{WebSocketDomAction, WebSocketNetworkEvent};
use net_traits::hosts::replace_host;
use net_traits::request::Type;
use openssl::ssl::{SslContext, SslStream};
use servo_url::ServoUrl;
use std::ascii::AsciiExt;
use std::io::{self, Write};
@ -35,14 +35,12 @@ use websocket::sender::Sender;
pub fn init(connect: WebSocketCommunicate,
connect_data: WebSocketConnectData,
cookie_jar: Arc<RwLock<CookieStorage>>,
ssl_context: Arc<SslContext>) {
cookie_jar: Arc<RwLock<CookieStorage>>) {
thread::Builder::new().name(format!("WebSocket connection to {}", connect_data.resource_url)).spawn(move || {
let channel = establish_a_websocket_connection(&connect_data.resource_url,
connect_data.origin,
connect_data.protocols,
cookie_jar,
ssl_context);
cookie_jar);
let (ws_sender, mut receiver) = match channel {
Ok((protocol_in_use, sender, receiver)) => {
let _ = connect.event_sender.send(WebSocketNetworkEvent::ConnectionEstablished { protocol_in_use });
@ -117,11 +115,10 @@ pub fn init(connect: WebSocketCommunicate,
}).expect("Thread spawning failed");
}
type Stream = HttpsStream<SslStream<HttpStream>>;
type Stream = HttpStream;
// https://fetch.spec.whatwg.org/#concept-websocket-connection-obtain
fn obtain_a_websocket_connection(url: &ServoUrl, ssl_context: Arc<SslContext>)
-> Result<Stream, NetworkError> {
fn obtain_a_websocket_connection(url: &ServoUrl) -> Result<Stream, NetworkError> {
// Step 1.
let host = url.host_str().unwrap();
@ -137,27 +134,23 @@ fn obtain_a_websocket_connection(url: &ServoUrl, ssl_context: Arc<SslContext>)
_ => panic!("URL's scheme should be ws or wss"),
};
if secure {
return Err(NetworkError::Internal("WSS is disabled for now.".into()));
}
// Steps 4-5.
let host = replace_host(host);
let tcp_stream = TcpStream::connect((&*host, port)).map_err(|e| {
NetworkError::Internal(format!("Could not connect to host: {}", e))
})?;
let http_stream = HttpStream(tcp_stream);
if !secure {
return Ok(HttpsStream::Http(http_stream));
}
let ssl_stream = SslStream::connect(&*ssl_context, http_stream).map_err(|e| {
NetworkError::from_ssl_error(url, &e)
})?;
Ok(HttpsStream::Https(ssl_stream))
Ok(HttpStream(tcp_stream))
}
// https://fetch.spec.whatwg.org/#concept-websocket-establish
fn establish_a_websocket_connection(resource_url: &ServoUrl,
origin: String,
protocols: Vec<String>,
cookie_jar: Arc<RwLock<CookieStorage>>,
ssl_context: Arc<SslContext>)
cookie_jar: Arc<RwLock<CookieStorage>>)
-> Result<(Option<String>,
Sender<Stream>,
Receiver<Stream>),
@ -192,7 +185,7 @@ fn establish_a_websocket_connection(resource_url: &ServoUrl,
// TODO: handle permessage-deflate extension.
// Step 11 and network error check from step 12.
let response = fetch(resource_url, origin, headers, cookie_jar, ssl_context)?;
let response = fetch(resource_url, origin, headers, cookie_jar)?;
// Step 12, the status code check.
if response.status != StatusCode::SwitchingProtocols {
@ -279,8 +272,7 @@ struct Response {
fn fetch(url: &ServoUrl,
origin: String,
mut headers: Headers,
cookie_jar: Arc<RwLock<CookieStorage>>,
ssl_context: Arc<SslContext>)
cookie_jar: Arc<RwLock<CookieStorage>>)
-> Result<Response, NetworkError> {
// Step 1.
// TODO: handle request's window.
@ -324,15 +316,14 @@ fn fetch(url: &ServoUrl,
}
// Step 8.
main_fetch(url, origin, headers, cookie_jar, ssl_context)
main_fetch(url, origin, headers, cookie_jar)
}
// https://fetch.spec.whatwg.org/#concept-main-fetch
fn main_fetch(url: &ServoUrl,
origin: String,
mut headers: Headers,
cookie_jar: Arc<RwLock<CookieStorage>>,
ssl_context: Arc<SslContext>)
cookie_jar: Arc<RwLock<CookieStorage>>)
-> Result<Response, NetworkError> {
// Step 1.
let mut response = None;
@ -375,7 +366,7 @@ fn main_fetch(url: &ServoUrl,
// doesn't need to be filtered at all.
// Step 12.2.
basic_fetch(url, origin, &mut headers, cookie_jar, ssl_context)
basic_fetch(url, origin, &mut headers, cookie_jar)
});
// Step 13.
@ -413,19 +404,17 @@ fn main_fetch(url: &ServoUrl,
fn basic_fetch(url: &ServoUrl,
origin: String,
headers: &mut Headers,
cookie_jar: Arc<RwLock<CookieStorage>>,
ssl_context: Arc<SslContext>)
cookie_jar: Arc<RwLock<CookieStorage>>)
-> Result<Response, NetworkError> {
// In the case of a WebSocket request, HTTP fetch is always used.
http_fetch(url, origin, headers, cookie_jar, ssl_context)
http_fetch(url, origin, headers, cookie_jar)
}
// https://fetch.spec.whatwg.org/#concept-http-fetch
fn http_fetch(url: &ServoUrl,
origin: String,
headers: &mut Headers,
cookie_jar: Arc<RwLock<CookieStorage>>,
ssl_context: Arc<SslContext>)
cookie_jar: Arc<RwLock<CookieStorage>>)
-> Result<Response, NetworkError> {
// Step 1.
// Not applicable: with step 3 being useless here, this one is too.
@ -446,7 +435,7 @@ fn http_fetch(url: &ServoUrl,
// Not applicable: request's redirect mode is "error".
// Step 4.3.
let response = http_network_or_cache_fetch(url, origin, headers, cookie_jar, ssl_context);
let response = http_network_or_cache_fetch(url, origin, headers, cookie_jar);
// Step 4.4.
// Not applicable: CORS flag is unset.
@ -475,8 +464,7 @@ fn http_fetch(url: &ServoUrl,
fn http_network_or_cache_fetch(url: &ServoUrl,
origin: String,
headers: &mut Headers,
cookie_jar: Arc<RwLock<CookieStorage>>,
ssl_context: Arc<SslContext>)
cookie_jar: Arc<RwLock<CookieStorage>>)
-> Result<Response, NetworkError> {
// Steps 1-3.
// Not applicable: we don't even have a request yet, and there is no body
@ -552,7 +540,7 @@ fn http_network_or_cache_fetch(url: &ServoUrl,
// Not applicable: cache mode is "no-store".
// Step 22.2.
let forward_response = http_network_fetch(url, headers, cookie_jar, ssl_context);
let forward_response = http_network_fetch(url, headers, cookie_jar);
// Step 22.3.
// Not applicable: request's method is not unsafe.
@ -581,15 +569,14 @@ fn http_network_or_cache_fetch(url: &ServoUrl,
// https://fetch.spec.whatwg.org/#concept-http-network-fetch
fn http_network_fetch(url: &ServoUrl,
headers: &Headers,
cookie_jar: Arc<RwLock<CookieStorage>>,
ssl_context: Arc<SslContext>)
cookie_jar: Arc<RwLock<CookieStorage>>)
-> Result<Response, NetworkError> {
// Step 1.
// Not applicable: credentials flag is set.
// Steps 2-3.
// Request's mode is "websocket".
let connection = obtain_a_websocket_connection(url, ssl_context)?;
let connection = obtain_a_websocket_connection(url)?;
// Step 4.
// Not applicable: requests body is null.
@ -610,8 +597,10 @@ fn http_network_fetch(url: &ServoUrl,
if let Some(cookies) = response.headers.get::<SetCookie>() {
let mut jar = cookie_jar.write().unwrap();
for cookie in &**cookies {
if let Some(cookie) = Cookie::new_wrapped(cookie.clone(), url, CookieSource::HTTP) {
jar.push(cookie, url, CookieSource::HTTP);
if let Ok(cookie) = cookie_rs::Cookie::parse(&**cookie) {
if let Some(cookie) = Cookie::new_wrapped(cookie.into_owned(), url, CookieSource::HTTP) {
jar.push(cookie, url, CookieSource::HTTP);
}
}
}
}

Просмотреть файл

@ -10,11 +10,11 @@ name = "net_traits"
path = "lib.rs"
[dependencies]
cookie = "0.2.5"
cookie = "0.6"
heapsize = "0.3.0"
heapsize_derive = "0.1"
hyper = "0.9.9"
hyper_serde = "0.5"
hyper = "0.10"
hyper_serde = "0.6"
image = "0.12"
immeta = "0.3.1"
ipc-channel = "0.7"
@ -22,7 +22,6 @@ lazy_static = "0.2"
log = "0.3.5"
msg = {path = "../msg"}
num-traits = "0.1.32"
openssl = "0.7.6"
parse-hosts = "0.3.0"
serde = "0.9"
serde_derive = "0.9"

Просмотреть файл

@ -22,7 +22,6 @@ extern crate lazy_static;
extern crate log;
extern crate msg;
extern crate num_traits;
extern crate openssl;
extern crate parse_hosts;
extern crate serde;
#[macro_use]
@ -44,7 +43,6 @@ use hyper_serde::Serde;
use ipc_channel::Error as IpcError;
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use openssl::ssl::error::{OpensslError, SslError};
use request::{Request, RequestInit};
use response::{HttpsState, Response};
use servo_url::ServoUrl;
@ -377,17 +375,13 @@ pub enum CoreResourceMsg {
/// Try to make a websocket connection to a URL.
WebsocketConnect(WebSocketCommunicate, WebSocketConnectData),
/// Store a cookie for a given originating URL
SetCookieForUrl(ServoUrl,
#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
Cookie,
CookieSource),
/// Store cookies for a given originating URL
SetCookiesForUrl(ServoUrl, Vec<Serde<Cookie>>, CookieSource),
SetCookieForUrl(ServoUrl, Serde<Cookie<'static>>, CookieSource),
/// Store a set of cookies for a given originating URL
SetCookiesForUrl(ServoUrl, Vec<Serde<Cookie<'static>>>, CookieSource),
/// Retrieve the stored cookies for a given URL
GetCookiesForUrl(ServoUrl, IpcSender<Option<String>>, CookieSource),
/// Get a cookie by name for a given originating URL
GetCookiesDataForUrl(ServoUrl, IpcSender<Vec<Serde<Cookie>>>, CookieSource),
GetCookiesDataForUrl(ServoUrl, IpcSender<Vec<Serde<Cookie<'static>>>>, CookieSource),
/// Cancel a network request corresponding to a given `ResourceId`
Cancel(ResourceId),
/// Synchronization message solely for knowing the state of the ResourceChannelManager loop
@ -533,63 +527,13 @@ pub enum NetworkError {
impl NetworkError {
pub fn from_hyper_error(url: &ServoUrl, error: HyperError) -> Self {
if let HyperError::Ssl(ref ssl_error) = error {
if let Some(ssl_error) = ssl_error.downcast_ref::<SslError>() {
return NetworkError::from_ssl_error(url, ssl_error);
}
return NetworkError::from_ssl_error(url, &**ssl_error);
}
NetworkError::Internal(error.description().to_owned())
}
pub fn from_ssl_error(url: &ServoUrl, error: &SslError) -> Self {
if let SslError::OpenSslErrors(ref errors) = *error {
if errors.iter().any(is_cert_verify_error) {
let mut error_report = vec![format!("ssl error ({}):", openssl::version::version())];
let mut suggestion = None;
for err in errors {
if is_unknown_message_digest_err(err) {
suggestion = Some("<b>Servo recommends upgrading to a newer OpenSSL version.</b>");
}
error_report.push(format_ssl_error(err));
}
if let Some(suggestion) = suggestion {
error_report.push(suggestion.to_owned());
}
let error_report = error_report.join("<br>\n");
return NetworkError::SslValidation(url.clone(), error_report);
}
}
NetworkError::Internal(error.description().to_owned())
}
}
fn format_ssl_error(error: &OpensslError) -> String {
match error {
&OpensslError::UnknownError { ref library, ref function, ref reason } => {
format!("{}: {} - {}", library, function, reason)
}
}
}
// FIXME: This incredibly hacky. Make it more robust, and at least test it.
fn is_cert_verify_error(error: &OpensslError) -> bool {
match error {
&OpensslError::UnknownError { ref library, ref function, ref reason } => {
library == "SSL routines" &&
function.to_uppercase() == "SSL3_GET_SERVER_CERTIFICATE" &&
reason == "certificate verify failed"
}
}
}
fn is_unknown_message_digest_err(error: &OpensslError) -> bool {
match error {
&OpensslError::UnknownError { ref library, ref function, ref reason } => {
library == "asn1 encoding routines" &&
function == "ASN1_item_verify" &&
reason == "unknown message digest algorithm"
}
pub fn from_ssl_error(url: &ServoUrl, error: &Error) -> Self {
NetworkError::SslValidation(url.clone(), error.description().to_owned())
}
}

Просмотреть файл

@ -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"]}

Просмотреть файл

@ -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(())
}

Просмотреть файл

@ -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(())
},

Просмотреть файл

@ -13,14 +13,14 @@ path = "lib.rs"
app_units = "0.4"
bluetooth_traits = {path = "../bluetooth_traits"}
canvas_traits = {path = "../canvas_traits"}
cookie = "0.2.5"
cookie = "0.6"
devtools_traits = {path = "../devtools_traits"}
euclid = "0.11"
gfx_traits = {path = "../gfx_traits"}
heapsize = "0.3.0"
heapsize_derive = "0.1"
hyper = "0.9.9"
hyper_serde = "0.5"
hyper = "0.10"
hyper_serde = "0.6"
ipc-channel = "0.7"
libc = "0.2"
msg = {path = "../msg"}

Просмотреть файл

@ -16,7 +16,7 @@ use servo_url::ServoUrl;
pub enum WebDriverScriptCommand {
AddCookie(#[serde(deserialize_with = "::hyper_serde::deserialize",
serialize_with = "::hyper_serde::serialize")]
Cookie,
Cookie<'static>,
IpcSender<Result<(), WebDriverCookieError>>),
ExecuteScript(String, IpcSender<WebDriverJSResult>),
ExecuteAsyncScript(String, IpcSender<WebDriverJSResult>),
@ -24,8 +24,8 @@ pub enum WebDriverScriptCommand {
FindElementsCSS(String, IpcSender<Result<Vec<String>, ()>>),
FocusElement(String, IpcSender<Result<(), ()>>),
GetActiveElement(IpcSender<Option<String>>),
GetCookie(String, IpcSender<Vec<Serde<Cookie>>>),
GetCookies(IpcSender<Vec<Serde<Cookie>>>),
GetCookie(String, IpcSender<Vec<Serde<Cookie<'static>>>>),
GetCookies(IpcSender<Vec<Serde<Cookie<'static>>>>),
GetElementAttribute(String, String, IpcSender<Result<Option<String>, ()>>),
GetElementCSS(String, String, IpcSender<Result<String, ()>>),
GetElementRect(String, IpcSender<Result<Rect<f64>, ()>>),

Просмотреть файл

@ -11,9 +11,9 @@ path = "lib.rs"
[dependencies]
base64 = "0.4.1"
cookie = "0.2.5"
cookie = "0.6"
euclid = "0.11"
hyper = "0.9.9"
hyper = "0.10"
image = "0.12"
ipc-channel = "0.7"
log = "0.3.5"
@ -26,4 +26,4 @@ servo_config = {path = "../config", features = ["servo"]}
servo_url = {path = "../url", features = ["servo"]}
url = {version = "1.2", features = ["heap_size"]}
uuid = {version = "0.4", features = ["v4"]}
webdriver = "0.20"
webdriver = "0.22"

Просмотреть файл

@ -69,16 +69,22 @@ fn extension_routes() -> Vec<(Method, &'static str, ServoExtensionRoute)> {
fn cookie_msg_to_cookie(cookie: cookie_rs::Cookie) -> Cookie {
Cookie {
name: cookie.name,
value: cookie.value,
path: cookie.path.map(Nullable::Value).unwrap_or(Nullable::Null),
domain: cookie.domain.map(Nullable::Value).unwrap_or(Nullable::Null),
expiry: match cookie.expires {
name: cookie.name().to_owned(),
value: cookie.value().to_owned(),
path: match cookie.path() {
Some(path) => Nullable::Value(path.to_string()),
None => Nullable::Null
},
domain: match cookie.domain() {
Some(domain) => Nullable::Value(domain.to_string()),
None => Nullable::Null
},
expiry: match cookie.expires() {
Some(time) => Nullable::Value(Date::new(time.to_timespec().sec as u64)),
None => Nullable::Null
},
secure: cookie.secure,
httpOnly: cookie.httponly,
secure: cookie.secure(),
httpOnly: cookie.http_only(),
}
}
@ -100,14 +106,14 @@ struct WebDriverSession {
/// Time to wait for injected scripts to run before interrupting them. A [`None`] value
/// specifies that the script should run indefinitely.
script_timeout: Option<u32>,
script_timeout: Option<u64>,
/// Time to wait for a page to finish loading upon navigation.
load_timeout: u32,
load_timeout: Option<u64>,
/// Time to wait for the element location strategy when retrieving elements, and when
/// waiting for an element to become interactable.
implicit_wait_timeout: u32,
implicit_wait_timeout: Option<u64>,
}
impl WebDriverSession {
@ -117,8 +123,8 @@ impl WebDriverSession {
frame_id: None,
script_timeout: Some(30_000),
load_timeout: 300_000,
implicit_wait_timeout: 0,
load_timeout: Some(300_000),
implicit_wait_timeout: Some(0),
}
}
}
@ -369,7 +375,7 @@ impl Handler {
let timeout = session.load_timeout;
let timeout_chan = sender;
thread::spawn(move || {
thread::sleep(Duration::from_millis(timeout as u64));
thread::sleep(Duration::from_millis(timeout.unwrap()));
let _ = timeout_chan.send(LoadStatus::LoadTimeout);
});
@ -671,17 +677,19 @@ impl Handler {
fn handle_add_cookie(&self, params: &AddCookieParameters) -> WebDriverResult<WebDriverResponse> {
let (sender, receiver) = ipc::channel().unwrap();
let cookie = cookie_rs::Cookie {
name: params.name.to_owned(),
value: params.value.to_owned(),
path: params.path.to_owned().into(),
domain: params.domain.to_owned().into(),
expires: None,
max_age: None,
secure: params.secure,
httponly: params.httpOnly,
custom: BTreeMap::new()
let cookie = cookie_rs::Cookie::build(params.name.to_owned(), params.value.to_owned())
.secure(params.secure)
.http_only(params.httpOnly);
let cookie = match params.domain {
Nullable::Value(ref domain) => cookie.domain(domain.to_owned()),
_ => cookie,
};
let cookie = match params.path {
Nullable::Value(ref path) => cookie.path(path.to_owned()).finish(),
_ => cookie.finish(),
};
try!(self.frame_script_command(WebDriverScriptCommand::AddCookie(cookie, sender)));
match receiver.recv().unwrap() {
Ok(_) => Ok(WebDriverResponse::Void),
@ -701,17 +709,10 @@ impl Handler {
.as_mut()
.ok_or(WebDriverError::new(ErrorStatus::SessionNotCreated, "")));
// TODO: this conversion is crazy, spec should limit these to u32 and check upstream
let value = parameters.ms as u32;
match &parameters.type_[..] {
"script" => session.script_timeout = Some(value),
"page load" => session.load_timeout = value,
"implicit" => session.implicit_wait_timeout = value,
x => {
return Err(WebDriverError::new(ErrorStatus::InvalidSelector,
format!("Unknown timeout type {}", x)))
}
}
session.script_timeout = parameters.script;
session.load_timeout = parameters.page_load;
session.implicit_wait_timeout = parameters.implicit;
Ok(WebDriverResponse::Void)
}

Просмотреть файл

@ -196,7 +196,7 @@ def windows_msvc(context, force=False):
'''Bootstrapper for MSVC building on Windows.'''
deps_dir = os.path.join(context.sharedir, "msvc-dependencies")
deps_url = "https://servo-rust.s3.amazonaws.com/msvc-deps/"
deps_url = "https://servo-deps.s3.amazonaws.com/msvc-deps/"
def version(package):
return packages.WINDOWS_MSVC[package]

Просмотреть файл

@ -321,7 +321,7 @@ class MachCommands(CommandBase):
call(["editbin", "/nologo", "/subsystem:windows", path.join(servo_exe_dir, "servo.exe")],
verbose=verbose)
# on msvc, we need to copy in some DLLs in to the servo.exe dir
for ssl_lib in ["ssleay32md.dll", "libeay32md.dll"]:
for ssl_lib in ["libcryptoMD.dll", "libsslMD.dll"]:
shutil.copy(path.join(env['OPENSSL_LIB_DIR'], "../bin" + msvc_x64, ssl_lib),
servo_exe_dir)

Просмотреть файл

@ -407,7 +407,7 @@ class CommandBase(object):
# Link openssl
env["OPENSSL_INCLUDE_DIR"] = path.join(package_dir("openssl"), "include")
env["OPENSSL_LIB_DIR"] = path.join(package_dir("openssl"), "lib" + msvc_x64)
env["OPENSSL_LIBS"] = "ssleay32MD:libeay32MD"
env["OPENSSL_LIBS"] = "libsslMD:libcryptoMD"
# Link moztools
env["MOZTOOLS_PATH"] = path.join(package_dir("moztools"), "bin")

Просмотреть файл

@ -108,7 +108,7 @@ def copy_dependencies(binary_path, lib_path):
def copy_windows_dependencies(binary_path, destination):
try:
[shutil.copy(path.join(binary_path, d), destination) for d in ["libeay32md.dll", "ssleay32md.dll"]]
[shutil.copy(path.join(binary_path, d), destination) for d in ["libcryptoMD.dll", "libsslMD.dll"]]
except:
deps = [
"libstdc++-6.dll",
@ -119,8 +119,8 @@ def copy_windows_dependencies(binary_path, destination):
"zlib1.dll",
"libiconv-2.dll",
"libintl-8.dll",
"libeay32.dll",
"ssleay32.dll",
"libcryptoMD.dll",
"libsslMD.dll",
]
for d in deps:
dep_path = path.join("C:\\msys64\\mingw64\\bin", d)

Просмотреть файл

@ -21,5 +21,5 @@ WINDOWS_MSVC = {
"cmake": "3.6.1",
"moztools": "0.0.1-5",
"ninja": "1.7.1",
"openssl": "1.0.1t-vs2015",
"openssl": "1.1.0e-vs2015",
}

Просмотреть файл

@ -10,11 +10,12 @@ path = "lib.rs"
doctest = false
[dependencies]
cookie = "0.2"
cookie = "0.6"
devtools_traits = {path = "../../../components/devtools_traits"}
flate2 = "0.2.0"
hyper = "0.9.9"
hyper_serde = "0.5"
hyper = "0.10"
hyper-openssl = "0.2"
hyper_serde = "0.6"
ipc-channel = "0.7"
msg = {path = "../../../components/msg"}
net = {path = "../../../components/net"}

Просмотреть файл

@ -69,7 +69,7 @@ fn fn_cookie_constructor() {
let cookie = cookie_rs::Cookie::parse(" baz = bar; Domain = ").unwrap();
assert!(Cookie::new_wrapped(cookie.clone(), url, CookieSource::HTTP).is_some());
let cookie = Cookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
assert!(&**cookie.cookie.domain.as_ref().unwrap() == "example.com");
assert!(&**cookie.cookie.domain().as_ref().unwrap() == "example.com");
// cookie public domains test
let cookie = cookie_rs::Cookie::parse(" baz = bar; Domain = gov.ac").unwrap();
@ -88,11 +88,11 @@ fn fn_cookie_constructor() {
let cookie = cookie_rs::Cookie::parse(" baz = bar ; Secure; Path = /foo/bar/").unwrap();
let cookie = Cookie::new_wrapped(cookie, url, CookieSource::HTTP).unwrap();
assert!(cookie.cookie.value == "bar");
assert!(cookie.cookie.name == "baz");
assert!(cookie.cookie.secure);
assert!(&cookie.cookie.path.as_ref().unwrap()[..] == "/foo/bar/");
assert!(&cookie.cookie.domain.as_ref().unwrap()[..] == "example.com");
assert!(cookie.cookie.value() == "bar");
assert!(cookie.cookie.name() == "baz");
assert!(cookie.cookie.secure());
assert!(&cookie.cookie.path().as_ref().unwrap()[..] == "/foo/bar/");
assert!(&cookie.cookie.domain().as_ref().unwrap()[..] == "example.com");
assert!(cookie.host_only);
let u = &ServoUrl::parse("http://example.com/foobar").unwrap();
@ -125,7 +125,7 @@ fn test_sort_order() {
let b = cookie_rs::Cookie::parse("baz=bar;Path=/foo/bar/baz/").unwrap();
let b = Cookie::new_wrapped(b, url, CookieSource::HTTP).unwrap();
assert!(b.cookie.path.as_ref().unwrap().len() > a.cookie.path.as_ref().unwrap().len());
assert!(b.cookie.path().as_ref().unwrap().len() > a.cookie.path().as_ref().unwrap().len());
assert!(CookieStorage::cookie_comparator(&a, &b) == Ordering::Greater);
assert!(CookieStorage::cookie_comparator(&b, &a) == Ordering::Less);
assert!(CookieStorage::cookie_comparator(&a, &a_prime) == Ordering::Less);
@ -136,7 +136,8 @@ fn test_sort_order() {
fn add_cookie_to_storage(storage: &mut CookieStorage, url: &ServoUrl, cookie_str: &str)
{
let source = CookieSource::HTTP;
let cookie = Cookie::new_wrapped(cookie_rs::Cookie::parse(cookie_str).unwrap(), url, source).unwrap();
let cookie = cookie_rs::Cookie::parse(cookie_str.to_owned()).unwrap();
let cookie = Cookie::new_wrapped(cookie, url, source).unwrap();
storage.push(cookie, url, source);
}
@ -261,7 +262,7 @@ fn add_retrieve_cookies(set_location: &str,
let header = Header::parse_header(&[bytes]).unwrap();
let SetCookie(cookies) = header;
for bare_cookie in cookies {
let cookie = Cookie::new_wrapped(bare_cookie, &url, source).unwrap();
let cookie = Cookie::from_cookie_string(bare_cookie, &url, source).unwrap();
storage.push(cookie, &url, source);
}
}

Просмотреть файл

@ -20,7 +20,7 @@ fn run(set_location: &str, set_cookies: &[&str], final_location: &str) -> String
let header = Header::parse_header(&[bytes]);
if let Ok(SetCookie(cookies)) = header {
for bare_cookie in cookies {
if let Some(cookie) = Cookie::new_wrapped(bare_cookie, &url, source) {
if let Some(cookie) = Cookie::from_cookie_string(bare_cookie, &url, source) {
storage.push(cookie, &url, source);
}
}

Просмотреть файл

@ -18,10 +18,10 @@ use hyper::header::{Encoding, Location, Pragma, Quality, QualityItem, SetCookie,
use hyper::header::{Headers, Host, HttpDate, Referer as HyperReferer};
use hyper::method::Method;
use hyper::mime::{Mime, SubLevel, TopLevel};
use hyper::net::Openssl;
use hyper::server::{Request as HyperRequest, Response as HyperResponse, Server};
use hyper::status::StatusCode;
use hyper::uri::RequestUri;
use hyper_openssl;
use msg::constellation_msg::TEST_PIPELINE_ID;
use net::fetch::cors_cache::CorsCache;
use net::fetch::methods::FetchContext;
@ -524,9 +524,10 @@ fn test_fetch_with_hsts() {
let mut key_path = path.clone();
key_path.push("privatekey_for_testing.key");
let ssl = Openssl::with_cert_and_key(cert_path.into_os_string(), key_path.into_os_string())
let ssl = hyper_openssl::OpensslServer::from_files(key_path, cert_path)
.unwrap();
//takes an address and something that implements hyper::net::Ssl
let mut server = Server::https("0.0.0.0:0", ssl).unwrap().handle_threads(handler, 1).unwrap();
let context = FetchContext {

Просмотреть файл

@ -511,7 +511,7 @@ fn test_load_doesnt_add_host_to_sts_list_when_url_is_http_even_if_sts_headers_ar
#[test]
fn test_load_sets_cookies_in_the_resource_manager_when_it_get_set_cookie_header_in_response() {
let handler = move |_: HyperRequest, mut response: HyperResponse| {
response.headers_mut().set(SetCookie(vec![CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned())]));
response.headers_mut().set(SetCookie(vec!["mozillaIs=theBest".to_owned()]));
response.send(b"Yay!").unwrap();
};
let (mut server, url) = make_server(handler);
@ -543,7 +543,7 @@ fn test_load_sets_cookies_in_the_resource_manager_when_it_get_set_cookie_header_
fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_resource_manager() {
let handler = move |request: HyperRequest, response: HyperResponse| {
assert_eq!(request.headers.get::<CookieHeader>(),
Some(&CookieHeader(vec![CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned())])));
Some(&CookieHeader(vec!["mozillaIs=theBest".to_owned()])));
response.send(b"Yay!").unwrap();
};
let (mut server, url) = make_server(handler);
@ -581,7 +581,7 @@ fn test_load_sets_requests_cookies_header_for_url_by_getting_cookies_from_the_re
fn test_load_sends_cookie_if_nonhttp() {
let handler = move |request: HyperRequest, response: HyperResponse| {
assert_eq!(request.headers.get::<CookieHeader>(),
Some(&CookieHeader(vec![CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned())])));
Some(&CookieHeader(vec!["mozillaIs=theBest".to_owned()])));
response.send(b"Yay!").unwrap();
};
let (mut server, url) = make_server(handler);
@ -618,9 +618,8 @@ fn test_load_sends_cookie_if_nonhttp() {
#[test]
fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl() {
let handler = move |_: HyperRequest, mut response: HyperResponse| {
let mut pair = CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned());
pair.httponly = true;
response.headers_mut().set(SetCookie(vec![pair]));
let pair = vec!["mozillaIs=theBest; HttpOnly".to_owned()];
response.headers_mut().set(SetCookie(pair));
response.send(b"Yay!").unwrap();
};
let (mut server, url) = make_server(handler);
@ -653,9 +652,8 @@ fn test_cookie_set_with_httponly_should_not_be_available_using_getcookiesforurl(
#[test]
fn test_when_cookie_received_marked_secure_is_ignored_for_http() {
let handler = move |_: HyperRequest, mut response: HyperResponse| {
let mut pair = CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned());
pair.secure = true;
response.headers_mut().set(SetCookie(vec![pair]));
let pair = vec!["mozillaIs=theBest; Secure".to_owned()];
response.headers_mut().set(SetCookie(pair));
response.send(b"Yay!").unwrap();
};
let (mut server, url) = make_server(handler);
@ -951,14 +949,14 @@ fn test_redirect_from_x_to_y_provides_y_cookies_from_y() {
};
if path == "/com/" {
assert_eq!(request.headers.get(),
Some(&CookieHeader(vec![CookiePair::new("mozillaIsNot".to_owned(), "dotOrg".to_owned())])));
Some(&CookieHeader(vec!["mozillaIsNot=dotOrg".to_owned()])));
let location = shared_url_y.lock().unwrap().as_ref().unwrap().to_string();
response.headers_mut().set(Location(location));
*response.status_mut() = StatusCode::MovedPermanently;
response.send(b"").unwrap();
} else if path == "/org/" {
assert_eq!(request.headers.get(),
Some(&CookieHeader(vec![CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned())])));
Some(&CookieHeader(vec!["mozillaIs=theBest".to_owned()])));
response.send(b"Yay!").unwrap();
} else {
panic!("unexpected path {:?}", path)
@ -1032,7 +1030,7 @@ fn test_redirect_from_x_to_x_provides_x_with_cookie_from_first_response() {
response.send(b"").unwrap();
} else if path == "/subsequent/" {
assert_eq!(request.headers.get(),
Some(&CookieHeader(vec![CookiePair::new("mozillaIs".to_owned(), "theBest".to_owned())])));
Some(&CookieHeader(vec!["mozillaIs=theBest".to_owned()])));
response.send(b"Yay!").unwrap();
} else {
panic!("unexpected path {:?}", path)

Просмотреть файл

@ -6,6 +6,7 @@ extern crate cookie as cookie_rs;
extern crate devtools_traits;
extern crate flate2;
extern crate hyper;
extern crate hyper_openssl;
extern crate hyper_serde;
extern crate ipc_channel;
extern crate msg;