more http cache work

This commit is contained in:
Gregory Terzian 2017-08-03 12:17:29 +02:00
parent f36a4fb6d7
commit 2799b4eac9
39 changed files with 798 additions and 2164 deletions

View file

@ -524761,7 +524761,7 @@
"support"
],
"fetch/http-cache/cc-request.html": [
"d4417b8fd444362a3f217d1c95d37811a608e1a7",
"2002d341679139428e164cfe916dd39b9b664a3e",
"testharness"
],
"fetch/http-cache/freshness.html": [
@ -524769,7 +524769,7 @@
"testharness"
],
"fetch/http-cache/heuristic.html": [
"5b0d55f891cb2e235456cd65f4e9f63e07999410",
"63837026eb6085fc7d6220c3dcab200b4bcd1eca",
"testharness"
],
"fetch/http-cache/http-cache.js": [
@ -524781,7 +524781,7 @@
"testharness"
],
"fetch/http-cache/partial.html": [
"243e57c39f9e45e3e2acf845b36f3a140e3763bc",
"685057fe8876321a5d42bcf1e7582e6f0b745f85",
"testharness"
],
"fetch/http-cache/resources/http-cache.py": [
@ -524793,7 +524793,7 @@
"testharness"
],
"fetch/http-cache/vary.html": [
"fa9a2e0554671bf2de5826e66ac0ea73de28d530",
"45f337270cfa90932c7469802655e313367ac92f",
"testharness"
],
"fetch/nosniff/image.html": [

View file

@ -1,14 +0,0 @@
[304.htm]
type: testharness
[A 304 response with no CORS headers inherits from the stored response]
expected: FAIL
[A 304 can expand Access-Control-Expose-Headers]
expected: FAIL
[A 304 can contract Access-Control-Expose-Headers]
expected: FAIL
[A 304 can change Access-Control-Allow-Origin]
expected: FAIL

View file

@ -1,3 +0,0 @@
[request-cache-default-conditional.html]
type: testharness
disabled: https://github.com/servo/servo/issues/13441

View file

@ -1,11 +0,0 @@
[request-cache-default.html]
type: testharness
[RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists with Etag and fresh response]
expected: FAIL
[RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists with date and fresh response]
expected: FAIL
[RequestCache "default" mode checks the cache for previously cached content and avoids going to the network if a fresh response exists with Last-Modified and fresh response]
expected: FAIL

View file

@ -1,29 +0,0 @@
[request-cache-force-cache.html]
type: testharness
[RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses with Etag and stale response]
expected: FAIL
[RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses with date and stale response]
expected: FAIL
[RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses with Etag and fresh response]
expected: FAIL
[RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses with date and fresh response]
expected: FAIL
[RequestCache "force-cache" stores the response in the cache if it goes to the network with Etag and fresh response]
expected: FAIL
[RequestCache "force-cache" stores the response in the cache if it goes to the network with date and fresh response]
expected: FAIL
[RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for stale responses with Last-Modified and stale response]
expected: FAIL
[RequestCache "force-cache" mode checks the cache for previously cached content and avoid revalidation for fresh responses with Last-Modified and fresh response]
expected: FAIL
[RequestCache "force-cache" stores the response in the cache if it goes to the network with Last-Modified and fresh response]
expected: FAIL

View file

@ -1,65 +0,0 @@
[request-cache-only-if-cached.html]
type: testharness
[RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with Etag and stale response]
expected: FAIL
[RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with date and stale response]
expected: FAIL
[RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses with Etag and fresh response]
expected: FAIL
[RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses with date and fresh response]
expected: FAIL
[RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with Etag and fresh response]
expected: FAIL
[RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with date and fresh response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and fresh response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with date and fresh response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Etag and stale response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with date and stale response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Etag and fresh response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with date and fresh response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Etag and stale response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with date and stale response]
expected: FAIL
[RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for stale responses with Last-Modified and stale response]
expected: FAIL
[RequestCache "only-if-cached" mode checks the cache for previously cached content and avoids revalidation for fresh responses with Last-Modified and fresh response]
expected: FAIL
[RequestCache "only-if-cached" mode checks the cache for previously cached content and does not go to the network if a cached response is not found with Last-Modified and fresh response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Last-Modified and fresh response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") uses cached same-origin redirects to same-origin content with Last-Modified and stale response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Last-Modified and fresh response]
expected: FAIL
[RequestCache "only-if-cached" (with "same-origin") does not follow redirects across origins and rejects with Last-Modified and stale response]
expected: FAIL

View file

@ -1,20 +0,0 @@
[request-cache-reload.html]
type: testharness
[RequestCache "reload" mode does store the response in the cache with Etag and fresh response]
expected: FAIL
[RequestCache "reload" mode does store the response in the cache with date and fresh response]
expected: FAIL
[RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with Etag and fresh response]
expected: FAIL
[RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with date and fresh response]
expected: FAIL
[RequestCache "reload" mode does store the response in the cache with Last-Modified and fresh response]
expected: FAIL
[RequestCache "reload" mode does store the response in the cache even if a previous response is already stored with Last-Modified and fresh response]
expected: FAIL

View file

@ -1,14 +0,0 @@
[304-update.html]
type: testharness
[HTTP cache updates returned headers from a Last-Modified 304.]
expected: FAIL
[HTTP cache updates stored headers from a Last-Modified 304.]
expected: FAIL
[HTTP cache updates returned headers from a ETag 304.]
expected: FAIL
[HTTP cache updates stored headers from a ETag 304.]
expected: FAIL

View file

@ -1,11 +1,5 @@
[cc-request.html]
type: testharness
[HTTP cache does use aged stale response when request contains Cache-Control: max-stale that permits its use.]
expected: FAIL
[HTTP cache does reuse stale response with Age header when request contains Cache-Control: max-stale that permits its use.]
expected: FAIL
[HTTP cache generates 504 status code when nothing is in cache and request contains Cache-Control: only-if-cached.]
expected: FAIL

View file

@ -1,20 +0,0 @@
[freshness.html]
type: testharness
[HTTP cache reuses a response with a future Expires.]
expected: FAIL
[HTTP cache reuses a response with positive Cache-Control: max-age.]
expected: FAIL
[HTTP cache reuses a response with positive Cache-Control: max-age and a past Expires.]
expected: FAIL
[HTTP cache reuses a response with positive Cache-Control: max-age and an invalid Expires.]
expected: FAIL
[HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use.]
expected: FAIL
[HTTP cache stores a response with Cache-Control: no-cache, but revalidates upon use, even with max-age and Expires.]
expected: FAIL

View file

@ -1,29 +0,0 @@
[heuristic.html]
type: testharness
[HTTP cache reuses an unknown response with Last-Modified based upon heuristic freshness when Cache-Control: public is present.]
expected: FAIL
[HTTP cache reuses a 200 OK response with Last-Modified based upon heuristic freshness.]
expected: FAIL
[HTTP cache reuses a 203 Non-Authoritative Information response with Last-Modified based upon heuristic freshness.]
expected: FAIL
[HTTP cache reuses a 204 No Content response with Last-Modified based upon heuristic freshness.]
expected: FAIL
[HTTP cache reuses a 404 Not Found response with Last-Modified based upon heuristic freshness.]
expected: FAIL
[HTTP cache reuses a 405 Method Not Allowed response with Last-Modified based upon heuristic freshness.]
expected: FAIL
[HTTP cache reuses a 410 Gone response with Last-Modified based upon heuristic freshness.]
expected: FAIL
[HTTP cache reuses a 414 URI Too Long response with Last-Modified based upon heuristic freshness.]
expected: FAIL
[HTTP cache reuses a 501 Not Implemented response with Last-Modified based upon heuristic freshness.]
expected: FAIL

View file

@ -1,20 +1,11 @@
[invalidate.html]
type: testharness
[HTTP cache does not invalidate after a failed response from an unsafe request]
expected: FAIL
[HTTP cache invalidates after a successful response from an unknown method]
expected: FAIL
[HTTP cache does not invalidate Location URL after a failed response from an unsafe request]
expected: FAIL
[HTTP cache invalidates Location URL after a successful response from an unknown method]
expected: FAIL
[HTTP cache does not invalidate Content-Location URL after a failed response from an unsafe request]
expected: FAIL
[HTTP cache invalidates Content-Location URL after a successful response from an unknown method]
expected: FAIL

View file

@ -1,13 +1,5 @@
[partial.html]
type: testharness
[HTTP cache stores partial content and reuses it.]
expected: FAIL
[HTTP cache stores complete response and serves smaller ranges from it.]
expected: FAIL
[HTTP cache stores partial response and serves smaller ranges from it.]
expected: FAIL
[HTTP cache stores partial content and completes it.]
expected: FAIL

View file

@ -1,41 +0,0 @@
[status.html]
type: testharness
[HTTP cache avoids going to the network if it has a fresh 200 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 203 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 204 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 299 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 400 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 404 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 410 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 499 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 500 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 502 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 503 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 504 response.]
expected: FAIL
[HTTP cache avoids going to the network if it has a fresh 599 response.]
expected: FAIL

View file

@ -1,17 +0,0 @@
[vary.html]
type: testharness
[HTTP cache reuses Vary response when request matches.]
expected: FAIL
[HTTP cache doesn't invalidate existing Vary response.]
expected: FAIL
[HTTP cache doesn't pay attention to headers not listed in Vary.]
expected: FAIL
[HTTP cache reuses two-way Vary response when request matches.]
expected: FAIL
[HTTP cache reuses three-way Vary response when request matches.]
expected: FAIL

View file

@ -201,7 +201,8 @@
request_headers: [
["Cache-Control", "only-if-cached"]
],
expected_status: 504
expected_status: 504,
expected_response_text: ""
}
]
}

View file

@ -26,6 +26,7 @@
},
{
expected_type: "cached",
response_status: [299, "Whatever"],
}
]
},
@ -35,8 +36,7 @@
{
response_status: [299, "Whatever"],
response_headers: [
['Last-Modified', http_date(-3 * 100)],
['Cache-Control', 'public']
['Last-Modified', http_date(-3 * 100)]
],
},
{

View file

@ -24,7 +24,7 @@
response_status: [206, "Partial Content"],
response_headers: [
['Cache-Control', 'max-age=3600'],
['Content-Range', 'bytes 0-4/10']
['Content-Range', 'bytes 4-9/10']
],
response_body: "01234",
expected_request_headers: [
@ -36,12 +36,13 @@
['Range', "bytes=-5"]
],
expected_type: "cached",
expected_status: 206
expected_status: 206,
expected_response_text: "01234"
}
]
},
{
name: 'HTTP cache stores complete response and serves smaller ranges from it.',
name: 'HTTP cache stores complete response and serves smaller ranges from it(byte-range-spec).',
requests: [
{
response_headers: [
@ -51,15 +52,54 @@
},
{
request_headers: [
['Range', "bytes=-1"]
['Range', "bytes=0-1"]
],
expected_type: "cached",
expected_status: 206,
expected_response_text: "01"
},
]
},
{
name: 'HTTP cache stores complete response and serves smaller ranges from it(absent last-byte-pos).',
requests: [
{
response_headers: [
['Cache-Control', 'max-age=3600'],
],
response_body: "01234567890",
},
{
request_headers: [
['Range', "bytes=1-"]
],
expected_type: "cached",
expected_status: 206,
expected_response_text: "1234567890"
}
]
},
{
name: 'HTTP cache stores partial response and serves smaller ranges from it.',
name: 'HTTP cache stores complete response and serves smaller ranges from it(suffix-byte-range-spec).',
requests: [
{
response_headers: [
['Cache-Control', 'max-age=3600'],
],
response_body: "0123456789A",
},
{
request_headers: [
['Range', "bytes=-1"]
],
expected_type: "cached",
expected_status: 206,
expected_response_text: "A"
}
]
},
{
name: 'HTTP cache stores partial response and serves smaller ranges from it(byte-range-spec).',
requests: [
{
request_headers: [
@ -68,7 +108,55 @@
response_status: [206, "Partial Content"],
response_headers: [
['Cache-Control', 'max-age=3600'],
['Content-Range', 'bytes 0-4/10']
['Content-Range', 'bytes 4-9/10']
],
response_body: "01234",
},
{
request_headers: [
['Range', "bytes=6-8"]
],
expected_type: "cached",
expected_status: 206,
expected_response_text: "234"
}
]
},
{
name: 'HTTP cache stores partial response and serves smaller ranges from it(absent last-byte-pos).',
requests: [
{
request_headers: [
['Range', "bytes=-5"]
],
response_status: [206, "Partial Content"],
response_headers: [
['Cache-Control', 'max-age=3600'],
['Content-Range', 'bytes 4-9/10']
],
response_body: "01234",
},
{
request_headers: [
['Range', "bytes=6-"]
],
expected_type: "cached",
expected_status: 206,
expected_response_text: "234"
}
]
},
{
name: 'HTTP cache stores partial response and serves smaller ranges from it(suffix-byte-range-spec).',
requests: [
{
request_headers: [
['Range', "bytes=-5"]
],
response_status: [206, "Partial Content"],
response_headers: [
['Cache-Control', 'max-age=3600'],
['Content-Range', 'bytes 4-9/10']
],
response_body: "01234",
},
@ -77,7 +165,8 @@
['Range', "bytes=-1"]
],
expected_type: "cached",
expected_response_text: "01"
expected_status: 206,
expected_response_text: "4"
}
]
},

View file

@ -103,6 +103,7 @@
request_headers: [
["Foo", "1"]
],
response_body: http_content('foo_1'),
expected_type: "cached"
}
]
@ -245,7 +246,32 @@
]
},
{
name: "HTTP cache doesn't use three-way Vary response when request omits variant header.",
name: "HTTP cache doesn't use three-way Vary response when request doesn't match, regardless of header order.",
requests: [
{
request_headers: [
["Foo", "1"],
["Bar", "abc4"],
["Baz", "789"]
],
response_headers: [
["Expires", http_date(5000)],
["Last-Modified", http_date(-3000)],
["Vary", "Foo, Bar, Baz"]
]
},
{
request_headers: [
["Foo", "1"],
["Bar", "abc"],
["Baz", "789"]
],
expected_type: "not_cached"
}
]
},
{
name: "HTTP cache uses three-way Vary response when both request and the original request omited a variant header.",
requests: [
{
request_headers: [
@ -259,6 +285,33 @@
]
},
{
request_headers: [
["Foo", "1"],
["Baz", "789"]
],
expected_type: "cached"
}
]
},
{
name: "HTTP cache doesn't use Vary response with a field value of '*'.",
requests: [
{
request_headers: [
["Foo", "1"],
["Baz", "789"]
],
response_headers: [
["Expires", http_date(5000)],
["Last-Modified", http_date(-3000)],
["Vary", "*"]
]
},
{
request_headers: [
["*", "1"],
["Baz", "789"]
],
expected_type: "not_cached"
}
]