-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Network: HTTP Request to resource cached previously would not consider range header when constructing response after revalidation. #40050
Copy link
Copy link
Closed
web-platform-tests/wpt
#55613Labels
A-networkC-assignedThere is someone working on resolving the issueThere is someone working on resolving the issue
Description
Describe the bug:
Current http cache would reconstruct cached response if cache exist but need revalidation after validating it as not modified, but will not consider the range header when constructing the response again.
To Reproduce:
- Setup HTTP server using nginx, using below configuration:
server {
listen 80;
server_name example.com;
location / {
root /var/www/html
add_header age 51608;
}
}
Note: here the purpose of adding 'age' header is to simulate the scenario that the resource that we are fetching is being cached in proxy for more than 24 hours.
2. place fetch.html, and big file (e.g. video file) under /var/www/html, the content of the fetch.html is as below:
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
fetch script!
<button id="whole">Fetch Whole</button>
<button id="partial">Fetch Partial</button>
<script>
const url = "mossel_giftbox.mp4"
let btnWhole = document.getElementById("whole");
btnWhole.onclick = async () => {
const response = await fetch(url);
const blob = await response.blob();
console.log("Fetched whole blob:", blob.size);
}
let btnPartial = document.getElementById("partial");
btnPartial.onclick = async () => {
const response = await fetch(url, { headers: { Range: "bytes=0-1024" } });
const blob = await response.blob();
console.log("Fetched partial blob:", blob.size);
}
</script>
</body>
</html>- Try press the Fetch Whole button, wait until the fetch request is finished, and the log is shown.
- Press the Fetch Partial button, observe the log.
| Chromium Behaviour | Servo Behavior |
|---|---|
| Fetched Whole blob: 35768068 | Fetched Whole blob: 35768068 |
| Fetched Partial blob: 1024 | Fetched Partial blob: 35768068 |
Platform:
Tested on Ubuntu 24.04
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-networkC-assignedThere is someone working on resolving the issueThere is someone working on resolving the issue