mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Remove net from dependencies
This commit is contained in:
parent
68472fabf8
commit
74ecc2bd64
6 changed files with 30 additions and 20 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -5304,7 +5304,6 @@ dependencies = [
|
||||||
"mozangle",
|
"mozangle",
|
||||||
"mozjs",
|
"mozjs",
|
||||||
"msg",
|
"msg",
|
||||||
"net",
|
|
||||||
"net_traits",
|
"net_traits",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"parking_lot 0.11.2",
|
"parking_lot 0.11.2",
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use headers::HeaderMap;
|
use headers::HeaderMap;
|
||||||
|
use net_traits::fetch::headers::get_value_from_header_list;
|
||||||
use std::iter::Peekable;
|
use std::iter::Peekable;
|
||||||
use std::str::Chars;
|
use std::str::Chars;
|
||||||
|
|
||||||
|
@ -155,19 +156,3 @@ fn collect_http_quoted_string(position: &mut Peekable<Chars>, extract_value: boo
|
||||||
// Step 6, 7
|
// Step 6, 7
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://fetch.spec.whatwg.org/#concept-header-list-get>
|
|
||||||
pub fn get_value_from_header_list(name: &str, headers: &HeaderMap) -> Option<String> {
|
|
||||||
let values = headers
|
|
||||||
.get_all(name)
|
|
||||||
.iter()
|
|
||||||
.map(|val| val.to_str().unwrap());
|
|
||||||
|
|
||||||
// Step 1
|
|
||||||
if values.size_hint() == (0, Some(0)) {
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Step 2
|
|
||||||
return Some(values.collect::<Vec<&str>>().join(", "));
|
|
||||||
}
|
|
||||||
|
|
21
components/net_traits/fetch/headers.rs
Normal file
21
components/net_traits/fetch/headers.rs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
use headers::HeaderMap;
|
||||||
|
|
||||||
|
/// <https://fetch.spec.whatwg.org/#concept-header-list-get>
|
||||||
|
pub fn get_value_from_header_list(name: &str, headers: &HeaderMap) -> Option<String> {
|
||||||
|
let values = headers
|
||||||
|
.get_all(name)
|
||||||
|
.iter()
|
||||||
|
.map(|val| val.to_str().unwrap());
|
||||||
|
|
||||||
|
// Step 1
|
||||||
|
if values.size_hint() == (0, Some(0)) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 2
|
||||||
|
return Some(values.collect::<Vec<&str>>().join(", "));
|
||||||
|
}
|
|
@ -53,6 +53,11 @@ pub mod image {
|
||||||
pub mod base;
|
pub mod base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An implementation of the [Fetch specification](https://fetch.spec.whatwg.org/)
|
||||||
|
pub mod fetch {
|
||||||
|
pub mod headers;
|
||||||
|
}
|
||||||
|
|
||||||
/// A loading context, for context-specific sniffing, as defined in
|
/// A loading context, for context-specific sniffing, as defined in
|
||||||
/// <https://mimesniff.spec.whatwg.org/#context-specific-sniffing>
|
/// <https://mimesniff.spec.whatwg.org/#context-specific-sniffing>
|
||||||
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
#[derive(Clone, Debug, Deserialize, MallocSizeOf, Serialize)]
|
||||||
|
|
|
@ -76,7 +76,6 @@ mime = "0.3.13"
|
||||||
mime_guess = "2.0.0"
|
mime_guess = "2.0.0"
|
||||||
mitochondria = "1.1.2"
|
mitochondria = "1.1.2"
|
||||||
msg = { path = "../msg" }
|
msg = { path = "../msg" }
|
||||||
net = { path = "../net" }
|
|
||||||
net_traits = { path = "../net_traits" }
|
net_traits = { path = "../net_traits" }
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
parking_lot = "0.11"
|
parking_lot = "0.11"
|
||||||
|
|
|
@ -13,8 +13,9 @@ use crate::dom::globalscope::GlobalScope;
|
||||||
use data_url::mime::Mime as DataUrlMime;
|
use data_url::mime::Mime as DataUrlMime;
|
||||||
use dom_struct::dom_struct;
|
use dom_struct::dom_struct;
|
||||||
use http::header::{HeaderMap as HyperHeaders, HeaderName, HeaderValue};
|
use http::header::{HeaderMap as HyperHeaders, HeaderName, HeaderValue};
|
||||||
use net::fetch::headers::get_value_from_header_list;
|
use net_traits::{
|
||||||
use net_traits::request::is_cors_safelisted_request_header;
|
fetch::headers::get_value_from_header_list, request::is_cors_safelisted_request_header,
|
||||||
|
};
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use std::str::{self, FromStr};
|
use std::str::{self, FromStr};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue