fix http cache reconstruct response from cache after validation behaviour#40067
fix http cache reconstruct response from cache after validation behaviour#40067TimvdLippe merged 2 commits intoservo:mainfrom
Conversation
|
This seems to fail some http cache unit test. |
b3407cc to
2ac0ab6
Compare
|
🔨 Triggering try run (#18712870431) for Linux (WPT) |
|
Test results for linux-wpt from try job (#18712870431): Flaky unexpected result (24)
Stable unexpected results that are known to be intermittent (21)
|
|
✨ Try run (#18712870431) succeeded. |
TimvdLippe
left a comment
There was a problem hiding this comment.
Can you add a new WPT test following the steps in https://book.servo.org/hacking/testing.html ? You can add the test in https://github.com/servo/servo/tree/main/tests/wpt/tests/fetch/range and most likely you can use non-matching-range-response.html as inspiration.
|
Implementation-wise this looks reasonable. I agree that I'd like to see an automated test covering this situation! |
…iour Signed-off-by: rayguo17 <[email protected]>
2ac0ab6 to
8bed438
Compare
|
🤖 Opened new upstream WPT pull request (web-platform-tests/wpt#55613) with upstreamable changes. |
TimvdLippe
left a comment
There was a problem hiding this comment.
Lots of stylistic nits. The main concern is that the test as written doesn't pass in Firefox or Safari (yet it passes in Chrome based on its logs). Does this mean Firefox/Safari lack support or is there a different way we should write the test so that it passes in all browsers?
| const response_2 = await fetch(url.toString(), { | ||
| headers: {'Range': 'bytes=0-99'} | ||
| }); | ||
| assert_equals(response_2.status, 206, 'Range fetch after cache revalidation should succeed with 206'); |
There was a problem hiding this comment.
Firefox and Safari appear to return 200 instead: https://wpt.fyi/results/fetch/range/cache-revalidate-construct-range-response.html?pr=55613 This test should pass on those browsers as well. Can we update the test so that it correctly runs there and then update Servo to return the same results?
There was a problem hiding this comment.
https://wpt.fyi/results/fetch/http-cache/partial.any.html?label=master&label=experimental&product=chrome&product=edge&product=firefox&product=safari&product=servo&aligned Seems like the problem is Firefox and safari would not tried to construct partial response from http_cache, hence not sending request with "IF-None-Match" or "If-Modified-Since" Headers. Given the scope of this test is to test whether UA could return partial request correctly if there are expired test in the http_cache, maybe i can modify the python to handle range request directly if received.
tests/wpt/tests/fetch/range/resources/video-with-aged-proxy-cache.py
Outdated
Show resolved
Hide resolved
tests/wpt/tests/fetch/range/resources/video-with-aged-proxy-cache.py
Outdated
Show resolved
Hide resolved
| function cache_revalidation_test(expect, label) { | ||
| promise_test(async t => { | ||
| const url = new URL('resources/video-with-aged-proxy-cache.py', location.href); | ||
| const response_1 = await fetch(url.toString()); |
There was a problem hiding this comment.
Nit: string conversion isn't required for url when fetching
| const response_1 = await fetch(url.toString()); | |
| const response_1 = await fetch(url); |
| assert_equals(response_1.status, 200, 'Initial fetch should succeed with 200'); | ||
| const response_1_blob = await response_1.blob(); | ||
| assert_equals(response_1_blob.size, 80666, 'Initial fetch should get full content'); | ||
| const response_2 = await fetch(url.toString(), { |
There was a problem hiding this comment.
| const response_2 = await fetch(url.toString(), { | |
| const response_2 = await fetch(url, { |
tests/wpt/tests/fetch/range/cache-revalidate-construct-range-response.html
Outdated
Show resolved
Hide resolved
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#55613). |
…red cache Signed-off-by: rayguo17 <[email protected]>
35a0ea0 to
d01266a
Compare
|
📝 Transplanted new upstreamable changes to existing upstream WPT pull request (web-platform-tests/wpt#55613). |
TimvdLippe
left a comment
There was a problem hiding this comment.
Looking at https://wpt.fyi/results/fetch/range/cache-revalidate-construct-range-response.html?label=pr_head&max-count=1&pr=55613 looks like it passes in all browsers. Thanks for fixing the issue and adding a test!
|
|
||
| promise_test(async t => { | ||
| const url = new URL('resources/video-with-aged-proxy-cache.py', location.href); | ||
| const response_1 = await fetch(url.toString()); |
There was a problem hiding this comment.
In my previous review I had a nit for this. Make sure to address review comments or acknowledge them if you disagree with them. This is a nit, so we can merge this now, but in the future please do ensure you address the full review.
There was a problem hiding this comment.
My apology, I have changed it in local environment, may have lost it when I am switching develop environment.
In the scenario of constructing response from cache resources after successful validation of expired cache resouce, Instead of just copying full body of the cached_resource, check if range header exist in request, if so reuse handle_range_request function to construct response.
Testing: Should past the manual test case in Issue #40050
Fixes: #40050