mirror of
https://github.com/servo/servo.git
synced 2025-06-12 10:24:43 +00:00
* fix: improve spec conformance around request header validation Signed-off-by: Shane Handley <shanehandley@fastmail.com> * account for additional test passes Signed-off-by: Shane Handley <shanehandley@fastmail.com> * fix: remove redundant .to_vec call Signed-off-by: Shane Handley <shanehandley@fastmail.com> --------- Signed-off-by: Shane Handley <shanehandley@fastmail.com>
16 lines
635 B
Rust
16 lines
635 B
Rust
/* 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;
|
|
use net_traits::fetch::headers::get_decode_and_split_header_name;
|
|
|
|
/// <https://fetch.spec.whatwg.org/#determine-nosniff>
|
|
pub fn determine_nosniff(headers: &HeaderMap) -> bool {
|
|
let values = get_decode_and_split_header_name("x-content-type-options", headers);
|
|
|
|
match values {
|
|
None => false,
|
|
Some(values) => !values.is_empty() && values[0].eq_ignore_ascii_case("nosniff"),
|
|
}
|
|
}
|