Refuse to provide partial response from earlier ranged request to API that did not make a range request (#36227)

Part of https://github.com/servo/servo/issues/33616

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-03-31 12:34:32 +02:00 committed by GitHub
parent 272da2981d
commit bc898da5de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 13 deletions

View file

@ -26,7 +26,7 @@ use headers::{
};
use http::header::{
self, ACCEPT, AUTHORIZATION, CONTENT_ENCODING, CONTENT_LANGUAGE, CONTENT_LOCATION,
CONTENT_TYPE, HeaderValue,
CONTENT_TYPE, HeaderValue, RANGE,
};
use http::{HeaderMap, Method, Request as HyperRequest, StatusCode};
use http_body_util::combinators::BoxBody;
@ -1123,7 +1123,7 @@ pub async fn http_redirect_fetch(
fetch_response
}
/// [HTTP network or cache fetch](https://fetch.spec.whatwg.org#http-network-or-cache-fetch)
/// [HTTP network or cache fetch](https://fetch.spec.whatwg.org/#concept-http-network-or-cache-fetch)
#[async_recursion]
async fn http_network_or_cache_fetch(
fetch_params: &mut FetchParams,
@ -1598,8 +1598,12 @@ async fn http_network_or_cache_fetch(
}
// TODO(#33616): Step 11. Set responses URL list to a clone of httpRequests URL list.
// TODO(#33616): Step 12. If httpRequests header list contains `Range`,
// then set responses range-requested flag.
// Step 12. If httpRequests header list contains `Range`, then set responses range-requested flag.
if http_request.headers.contains_key(RANGE) {
response.range_requested = true;
}
// TODO(#33616): Step 13 Set responses request-includes-credentials to includeCredentials.
// Step 14. If responses status is 401, httpRequests response tainting is not "cors",