diff --git a/Cargo.lock b/Cargo.lock index a38e6b2adf7..1bdcd7979de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3085,7 +3085,7 @@ dependencies = [ "msg 0.0.1", "net_traits 0.0.1", "openssl 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "pixels 0.0.1", "profile_traits 0.0.1", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3137,7 +3137,7 @@ dependencies = [ "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "msg 0.0.1", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "pixels 0.0.1", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", "servo_arc 0.1.1", @@ -4018,7 +4018,7 @@ dependencies = [ "net_traits 0.0.1", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "phf 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "phf_codegen 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", "phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/components/net/Cargo.toml b/components/net/Cargo.toml index 07be06f1ff8..b2bcbc0d7bf 100644 --- a/components/net/Cargo.toml +++ b/components/net/Cargo.toml @@ -42,7 +42,7 @@ mime_guess = "2.0.0-alpha.6" msg = {path = "../msg"} net_traits = {path = "../net_traits"} openssl = "0.10" -percent-encoding = "1.0" +percent-encoding = "2.0" pixels = {path = "../pixels"} profile_traits = {path = "../profile_traits"} rayon = "1" diff --git a/components/net_traits/Cargo.toml b/components/net_traits/Cargo.toml index 9cde86cfc73..ccb099a3139 100644 --- a/components/net_traits/Cargo.toml +++ b/components/net_traits/Cargo.toml @@ -29,7 +29,7 @@ malloc_size_of_derive = "0.1" mime = "0.3" msg = {path = "../msg"} num-traits = "0.2" -percent-encoding = "1.0" +percent-encoding = "2.0" pixels = {path = "../pixels"} serde = "1.0" servo_arc = {path = "../servo_arc"} diff --git a/components/net_traits/lib.rs b/components/net_traits/lib.rs index 89719a37499..1f3bf88ba58 100644 --- a/components/net_traits/lib.rs +++ b/components/net_traits/lib.rs @@ -653,14 +653,29 @@ pub fn trim_http_whitespace(mut slice: &[u8]) -> &[u8] { } pub fn http_percent_encode(bytes: &[u8]) -> String { - percent_encoding::define_encode_set! { - // This encode set is used for HTTP header values and is defined at - // https://tools.ietf.org/html/rfc5987#section-3.2 - pub HTTP_VALUE = [percent_encoding::SIMPLE_ENCODE_SET] | { - ' ', '"', '%', '\'', '(', ')', '*', ',', '/', ':', ';', '<', '-', '>', '?', - '[', '\\', ']', '{', '}' - } - } + // This encode set is used for HTTP header values and is defined at + // https://tools.ietf.org/html/rfc5987#section-3.2 + const HTTP_VALUE: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS + .add(b' ') + .add(b'"') + .add(b'%') + .add(b'\'') + .add(b'(') + .add(b')') + .add(b'*') + .add(b',') + .add(b'/') + .add(b':') + .add(b';') + .add(b'<') + .add(b'-') + .add(b'>') + .add(b'?') + .add(b'[') + .add(b'\\') + .add(b']') + .add(b'{') + .add(b'}'); percent_encoding::percent_encode(bytes, HTTP_VALUE).to_string() } diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 7bf317ba739..f9d23d26615 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -79,7 +79,7 @@ msg = {path = "../msg"} net_traits = {path = "../net_traits"} num-traits = "0.2" parking_lot = "0.8" -percent-encoding = "1.0" +percent-encoding = "2.0" phf = "0.7" pixels = {path = "../pixels"} profile_traits = {path = "../profile_traits"}