mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Remove net from dependencies
This commit is contained in:
parent
68472fabf8
commit
74ecc2bd64
6 changed files with 30 additions and 20 deletions
|
@ -3,6 +3,7 @@
|
|||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use headers::HeaderMap;
|
||||
use net_traits::fetch::headers::get_value_from_header_list;
|
||||
use std::iter::Peekable;
|
||||
use std::str::Chars;
|
||||
|
||||
|
@ -155,19 +156,3 @@ fn collect_http_quoted_string(position: &mut Peekable<Chars>, extract_value: boo
|
|||
// Step 6, 7
|
||||
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(", "));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue