diff options
-rw-r--r-- | components/net/fetch/methods.rs | 11 | ||||
-rw-r--r-- | components/net/tests/http_loader.rs | 2 |
2 files changed, 4 insertions, 9 deletions
diff --git a/components/net/fetch/methods.rs b/components/net/fetch/methods.rs index 9ec79ec1bd4..09670ec106f 100644 --- a/components/net/fetch/methods.rs +++ b/components/net/fetch/methods.rs @@ -921,13 +921,10 @@ fn should_upgrade_request_to_potentially_trustworty( // request’s header list if any of the following criteria are met: // * request’s URL is not a potentially trustworthy URL // * request’s URL's host is not a preloadable HSTS host - if !request.current_url().is_origin_trustworthy() || - !context - .state - .hsts_list - .read() - .unwrap() - .is_host_secure(request.current_url().host_str().unwrap()) + if !request.current_url().is_potentially_trustworthy() || + !request.current_url().host_str().is_some_and(|host| { + !context.state.hsts_list.read().unwrap().is_host_secure(host) + }) { debug!("Appending the Upgrade-Insecure-Requests header to request’s header list"); request diff --git a/components/net/tests/http_loader.rs b/components/net/tests/http_loader.rs index 51853279c3a..793a73826dd 100644 --- a/components/net/tests/http_loader.rs +++ b/components/net/tests/http_loader.rs @@ -171,7 +171,6 @@ fn test_check_default_headers_loaded_in_every_request() { HeaderName::from_static("sec-fetch-user"), HeaderValue::from_static("?1"), ); - headers.insert("Upgrade-Insecure-Requests", HeaderValue::from_static("1")); *expected_headers.lock().unwrap() = Some(headers.clone()); @@ -326,7 +325,6 @@ fn test_request_and_response_data_with_network_messages() { HeaderName::from_static("sec-fetch-user"), HeaderValue::from_static("?1"), ); - headers.insert("Upgrade-Insecure-Requests", HeaderValue::from_static("1")); let httprequest = DevtoolsHttpRequest { url: url, |