mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Modify the checks for upgrade-request algorithm (#35357)
Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
This commit is contained in:
parent
3c1cce825d
commit
2bb720f0f1
2 changed files with 4 additions and 9 deletions
|
@ -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 header list if any of the following criteria are met:
|
||||||
// * request’s URL is not a potentially trustworthy URL
|
// * request’s URL is not a potentially trustworthy URL
|
||||||
// * request’s URL's host is not a preloadable HSTS host
|
// * request’s URL's host is not a preloadable HSTS host
|
||||||
if !request.current_url().is_origin_trustworthy() ||
|
if !request.current_url().is_potentially_trustworthy() ||
|
||||||
!context
|
!request.current_url().host_str().is_some_and(|host| {
|
||||||
.state
|
!context.state.hsts_list.read().unwrap().is_host_secure(host)
|
||||||
.hsts_list
|
})
|
||||||
.read()
|
|
||||||
.unwrap()
|
|
||||||
.is_host_secure(request.current_url().host_str().unwrap())
|
|
||||||
{
|
{
|
||||||
debug!("Appending the Upgrade-Insecure-Requests header to request’s header list");
|
debug!("Appending the Upgrade-Insecure-Requests header to request’s header list");
|
||||||
request
|
request
|
||||||
|
|
|
@ -171,7 +171,6 @@ fn test_check_default_headers_loaded_in_every_request() {
|
||||||
HeaderName::from_static("sec-fetch-user"),
|
HeaderName::from_static("sec-fetch-user"),
|
||||||
HeaderValue::from_static("?1"),
|
HeaderValue::from_static("?1"),
|
||||||
);
|
);
|
||||||
headers.insert("Upgrade-Insecure-Requests", HeaderValue::from_static("1"));
|
|
||||||
|
|
||||||
*expected_headers.lock().unwrap() = Some(headers.clone());
|
*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"),
|
HeaderName::from_static("sec-fetch-user"),
|
||||||
HeaderValue::from_static("?1"),
|
HeaderValue::from_static("?1"),
|
||||||
);
|
);
|
||||||
headers.insert("Upgrade-Insecure-Requests", HeaderValue::from_static("1"));
|
|
||||||
|
|
||||||
let httprequest = DevtoolsHttpRequest {
|
let httprequest = DevtoolsHttpRequest {
|
||||||
url: url,
|
url: url,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue