mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
more http cache work
This commit is contained in:
parent
f36a4fb6d7
commit
2799b4eac9
39 changed files with 798 additions and 2164 deletions
|
@ -201,7 +201,8 @@
|
|||
request_headers: [
|
||||
["Cache-Control", "only-if-cached"]
|
||||
],
|
||||
expected_status: 504
|
||||
expected_status: 504,
|
||||
expected_response_text: ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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)]
|
||||
],
|
||||
},
|
||||
{
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue