mirror of
https://github.com/servo/servo.git
synced 2025-08-07 22:45:34 +01:00
Auto merge of #23838 - servo:url-2.0, r=Manishearth
Update the url crate to 2.0 Blocked on: * [x] https://github.com/housleyjk/ws-rs/pull/283 + undoing corresponding `[patch.crates-io]` entry Soft-blocked on: (we could add to the crate duplication allow-list instead) * [x] ~https://github.com/rust-windowing/winit/pull/1066~ - [x] https://github.com/rust-windowing/winit/pull/1076 * [x] https://github.com/servo/media/pull/288 * [ ] https://github.com/servo/webrender/pull/3720 * [x] https://github.com/gobwas/influent.rs/pull/22 * [ ] https://bugzilla.mozilla.org/show_bug.cgi?id=1568540 - [x] https://github.com/seanmonstar/warp/pull/260 - [ ] https://github.com/abonander/multipart/pull/121 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23838) <!-- Reviewable:end -->
This commit is contained in:
commit
9bba14cb43
26 changed files with 96 additions and 362 deletions
|
@ -29,13 +29,14 @@ malloc_size_of_derive = "0.1"
|
|||
mime = "0.3"
|
||||
msg = {path = "../msg"}
|
||||
num-traits = "0.2"
|
||||
percent-encoding = "2.0"
|
||||
pixels = {path = "../pixels"}
|
||||
serde = "1.0"
|
||||
servo_arc = {path = "../servo_arc"}
|
||||
servo_config = {path = "../config"}
|
||||
servo_url = {path = "../url"}
|
||||
time = "0.1"
|
||||
url = "1.2"
|
||||
url = "2.0"
|
||||
uuid = {version = "0.7", features = ["v4", "serde"]}
|
||||
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@ extern crate malloc_size_of;
|
|||
extern crate malloc_size_of_derive;
|
||||
#[macro_use]
|
||||
extern crate serde;
|
||||
#[macro_use]
|
||||
extern crate url;
|
||||
|
||||
use crate::filemanager_thread::FileManagerThreadMsg;
|
||||
use crate::request::{Request, RequestBuilder};
|
||||
|
@ -35,7 +33,6 @@ use msg::constellation_msg::HistoryStateId;
|
|||
use servo_url::ServoUrl;
|
||||
use std::error::Error;
|
||||
use time::precise_time_ns;
|
||||
use url::percent_encoding;
|
||||
|
||||
pub mod blob_url_store;
|
||||
pub mod filemanager_thread;
|
||||
|
@ -656,14 +653,29 @@ pub fn trim_http_whitespace(mut slice: &[u8]) -> &[u8] {
|
|||
}
|
||||
|
||||
pub fn http_percent_encode(bytes: &[u8]) -> String {
|
||||
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'}');
|
||||
|
||||
url::percent_encoding::percent_encode(bytes, HTTP_VALUE).to_string()
|
||||
percent_encoding::percent_encode(bytes, HTTP_VALUE).to_string()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue