diff options
Diffstat (limited to 'components/net/fetch/methods.rs')
-rw-r--r-- | components/net/fetch/methods.rs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index 05559b57b41..12aff01e9a4 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -253,10 +253,10 @@ pub fn main_fetch( Response::network_error(NetworkError::Internal("Non-http scheme".into())) } else if request.use_cors_preflight || (request.unsafe_request && - (!is_cors_safelisted_method(&request.method) || request - .headers - .iter() - .any(|(name, value)| !is_cors_safelisted_request_header(&name, &value)))) + (!is_cors_safelisted_method(&request.method) || + request.headers.iter().any(|(name, value)| { + !is_cors_safelisted_request_header(&name, &value) + }))) { // Substep 1. request.response_tainting = ResponseTainting::CorsTainting; @@ -372,10 +372,12 @@ pub fn main_fetch( // in the previous step. let not_network_error = !response_is_network_error && !internal_response.is_network_error(); if not_network_error && - (is_null_body_status(&internal_response.status) || match request.method { - Method::HEAD | Method::CONNECT => true, - _ => false, - }) { + (is_null_body_status(&internal_response.status) || + match request.method { + Method::HEAD | Method::CONNECT => true, + _ => false, + }) + { // when Fetch is used only asynchronously, we will need to make sure // that nothing tries to write to the body at this point let mut body = internal_response.body.lock().unwrap(); @@ -785,7 +787,8 @@ pub fn should_be_blocked_due_to_nosniff( .get("x-content-type-options") .map_or(true, |val| { val.to_str().unwrap_or("").to_lowercase() != "nosniff" - }) { + }) + { return false; } @@ -850,12 +853,13 @@ fn should_be_blocked_due_to_mime_type( }; // Step 2-3 - destination.is_script_like() && match mime_type.type_() { - mime::AUDIO | mime::VIDEO | mime::IMAGE => true, - mime::TEXT if mime_type.subtype() == mime::CSV => true, - // Step 4 - _ => false, - } + destination.is_script_like() && + match mime_type.type_() { + mime::AUDIO | mime::VIDEO | mime::IMAGE => true, + mime::TEXT if mime_type.subtype() == mime::CSV => true, + // Step 4 + _ => false, + } } /// <https://fetch.spec.whatwg.org/#block-bad-port> |