Skip to content

Commit 7d7afb0

Browse files
committed
Update to percent-encoding 2.0
1 parent 47d4907 commit 7d7afb0

5 files changed

Lines changed: 29 additions & 14 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components/net/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ mime_guess = "2.0.0-alpha.6"
4242
msg = {path = "../msg"}
4343
net_traits = {path = "../net_traits"}
4444
openssl = "0.10"
45-
percent-encoding = "1.0"
45+
percent-encoding = "2.0"
4646
pixels = {path = "../pixels"}
4747
profile_traits = {path = "../profile_traits"}
4848
rayon = "1"

components/net_traits/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ malloc_size_of_derive = "0.1"
2929
mime = "0.3"
3030
msg = {path = "../msg"}
3131
num-traits = "0.2"
32-
percent-encoding = "1.0"
32+
percent-encoding = "2.0"
3333
pixels = {path = "../pixels"}
3434
serde = "1.0"
3535
servo_arc = {path = "../servo_arc"}

components/net_traits/lib.rs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -653,14 +653,29 @@ pub fn trim_http_whitespace(mut slice: &[u8]) -> &[u8] {
653653
}
654654

655655
pub fn http_percent_encode(bytes: &[u8]) -> String {
656-
percent_encoding::define_encode_set! {
657-
// This encode set is used for HTTP header values and is defined at
658-
// https://tools.ietf.org/html/rfc5987#section-3.2
659-
pub HTTP_VALUE = [percent_encoding::SIMPLE_ENCODE_SET] | {
660-
' ', '"', '%', '\'', '(', ')', '*', ',', '/', ':', ';', '<', '-', '>', '?',
661-
'[', '\\', ']', '{', '}'
662-
}
663-
}
656+
// This encode set is used for HTTP header values and is defined at
657+
// https://tools.ietf.org/html/rfc5987#section-3.2
658+
const HTTP_VALUE: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
659+
.add(b' ')
660+
.add(b'"')
661+
.add(b'%')
662+
.add(b'\'')
663+
.add(b'(')
664+
.add(b')')
665+
.add(b'*')
666+
.add(b',')
667+
.add(b'/')
668+
.add(b':')
669+
.add(b';')
670+
.add(b'<')
671+
.add(b'-')
672+
.add(b'>')
673+
.add(b'?')
674+
.add(b'[')
675+
.add(b'\\')
676+
.add(b']')
677+
.add(b'{')
678+
.add(b'}');
664679

665680
percent_encoding::percent_encode(bytes, HTTP_VALUE).to_string()
666681
}

components/script/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ msg = {path = "../msg"}
7979
net_traits = {path = "../net_traits"}
8080
num-traits = "0.2"
8181
parking_lot = "0.8"
82-
percent-encoding = "1.0"
82+
percent-encoding = "2.0"
8383
phf = "0.7"
8484
pixels = {path = "../pixels"}
8585
profile_traits = {path = "../profile_traits"}

0 commit comments

Comments
 (0)