Skip to content

Commit bb49f1d

Browse files
committed
Added: more spec_anchors
1 parent 7b8086a commit bb49f1d

19 files changed

+81
-6
lines changed

tests/age-parse.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default
99
{
1010
name: 'HTTP cache should ignore an `Age` header with a non-numeric value',
1111
id: 'age-parse-nonnumeric',
12+
spec_anchors: ['field.age'],
1213
depends_on: ['freshness-max-age-age'],
1314
requests: [
1415
{
@@ -28,6 +29,7 @@ export default
2829
{
2930
name: 'HTTP cache should ignore an `Age` header with a negative value',
3031
id: 'age-parse-negative',
32+
spec_anchors: ['field.age'],
3133
depends_on: ['freshness-max-age-age'],
3234
requests: [
3335
{
@@ -47,6 +49,7 @@ export default
4749
{
4850
name: 'HTTP cache should ignore an `Age` header with a float value',
4951
id: 'age-parse-float',
52+
spec_anchors: ['field.age'],
5053
depends_on: ['freshness-max-age-age'],
5154
requests: [
5255
{
@@ -66,6 +69,7 @@ export default
6669
{
6770
name: 'HTTP cache should consider a response with a `Age` value of 2147483647 to be stale',
6871
id: 'age-parse-large-minus-one',
72+
spec_anchors: ['field.age'],
6973
depends_on: ['freshness-max-age-age'],
7074
requests: [
7175
{
@@ -85,6 +89,7 @@ export default
8589
{
8690
name: 'HTTP cache should consider a response with a `Age` value of 2147483648 to be stale',
8791
id: 'age-parse-large',
92+
spec_anchors: ['delta-seconds'],
8893
depends_on: ['freshness-max-age-age'],
8994
requests: [
9095
{
@@ -104,6 +109,7 @@ export default
104109
{
105110
name: 'HTTP cache should consider a response with a `Age` value of 2147483649 to be stale',
106111
id: 'age-parse-larger',
112+
spec_anchors: ['delta-seconds'],
107113
depends_on: ['freshness-max-age-age'],
108114
requests: [
109115
{
@@ -123,6 +129,7 @@ export default
123129
{
124130
name: 'HTTP cache should consider a response with a single `Age` header line `old, 0` to be stale',
125131
id: 'age-parse-suffix',
132+
spec_anchors: ['field.age'],
126133
depends_on: ['freshness-max-age-age'],
127134
requests: [
128135
{
@@ -142,6 +149,7 @@ export default
142149
{
143150
name: 'HTTP cache should consider a response with a single `Age` header line `0, old` to be fresh',
144151
id: 'age-parse-prefix',
152+
spec_anchors: ['field.age'],
145153
depends_on: ['freshness-max-age-age'],
146154
requests: [
147155
{
@@ -161,6 +169,7 @@ export default
161169
{
162170
name: 'HTTP cache should use the first line in a response with multiple `Age` header lines: `old`, `0`',
163171
id: 'age-parse-suffix-twoline',
172+
spec_anchors: ['field.age'],
164173
depends_on: ['freshness-max-age-age'],
165174
requests: [
166175
{
@@ -181,6 +190,7 @@ export default
181190
{
182191
name: 'HTTP cache should use the first line in a response with multiple `Age` header lines: `0`, `old`',
183192
id: 'age-parse-prefix-twoline',
193+
spec_anchors: ['field.age'],
184194
depends_on: ['freshness-max-age-age'],
185195
requests: [
186196
{
@@ -201,6 +211,7 @@ export default
201211
{
202212
name: 'HTTP cache should consider a response with a single line `Age: 0, 0` to be fresh',
203213
id: 'age-parse-dup-0',
214+
spec_anchors: ['field.age'],
204215
depends_on: ['freshness-max-age-age'],
205216
requests: [
206217
{
@@ -220,6 +231,7 @@ export default
220231
{
221232
name: 'HTTP cache should consider a response with two `Age: 0` header lines to be fresh',
222233
id: 'age-parse-dup-0-twoline',
234+
spec_anchors: ['field.age'],
223235
depends_on: ['freshness-max-age-age'],
224236
requests: [
225237
{
@@ -240,6 +252,7 @@ export default
240252
{
241253
name: 'HTTP cache should consider a response with two `Age: not_old` header lines to be fresh',
242254
id: 'age-parse-dup-old',
255+
spec_anchors: ['field.age'],
243256
depends_on: ['freshness-max-age-age'],
244257
requests: [
245258
{

tests/authorization.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default
1111
{
1212
name: 'HTTP shared cache must not reuse a response to a request that contained `Authorization`, even with explicit freshness',
1313
id: 'other-authorization',
14+
spec_anchors: ['caching.authenticated.responses'],
1415
depends_on: ['freshness-max-age'],
1516
browser_skip: true,
1617
requests: [

tests/cc-parse.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export default
102102
name: 'HTTP cache must not reuse a response with `max-age` in a quoted string (before the "real" `max-age`)',
103103
id: 'freshness-max-age-ignore-quoted',
104104
depends_on: ['freshness-max-age'],
105+
spec_anchors: ['cache-response-directive.max-age'],
105106
requests: [
106107
{
107108
response_headers: [
@@ -119,6 +120,7 @@ export default
119120
name: 'HTTP cache mut not reuse a response with `max-age` in a quoted string (after the "real" `max-age`)',
120121
id: 'freshness-max-age-ignore-quoted-rev',
121122
depends_on: ['freshness-max-age'],
123+
spec_anchors: ['cache-response-directive.max-age'],
122124
requests: [
123125
{
124126
response_headers: [
@@ -171,6 +173,7 @@ export default
171173
{
172174
name: 'An optimal HTTP cache reuses max-age with the value `003600`',
173175
id: 'freshness-max-age-leading-zero',
176+
spec_anchors: ['delta-seconds'],
174177
depends_on: ['freshness-none'],
175178
requests: [
176179
{
@@ -189,6 +192,7 @@ export default
189192
name: 'HTTP cache must not reuse a response with a single-quoted `Cache-Control: max-age`',
190193
id: 'freshness-max-age-single-quoted',
191194
depends_on: ['freshness-none'],
195+
spec_anchors: ['cache-response-directive.max-age'],
192196
requests: [
193197
{
194198
response_headers: [

tests/cc-response.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ export default
354354
{
355355
name: 'A HTTP cache MUST revalidate a stale response with `Cache-Control: immutable`',
356356
id: 'cc-resp-immutable-stale',
357+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc8246.html#section-2'],
357358
browser_only: true,
358359
requests: [
359360
{

tests/cdn-cache-control.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ export default
6565
{
6666
name: 'CDN must not reuse a response when the `Age` header is greater than its `CDN-Cache-Control: max-age` freshness lifetime',
6767
id: 'cdn-max-age-age',
68+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
6869
cdn_only: true,
6970
depends_on: ['cdn-max-age'],
7071
requests: [
@@ -125,6 +126,7 @@ export default
125126
{
126127
name: 'CDN must not reuse a response with `CDN-Cache-Control: max-age=0`',
127128
id: 'cdn-max-age-0',
129+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
128130
cdn_only: true,
129131
depends_on: ['cdn-max-age'],
130132
requests: [
@@ -224,6 +226,7 @@ export default
224226
{
225227
name: 'CDN must not reuse a response with a `CDN-Cache-Control: max-age=0` and a future `Expires`',
226228
id: 'cdn-max-age-0-expires',
229+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
227230
cdn_only: true,
228231
depends_on: ['cdn-max-age'],
229232
requests: [
@@ -264,6 +267,7 @@ export default
264267
{
265268
name: 'CDN must prefer a short `CDN-Cache-Control: max-age` over a long `Cache-Control: max-age`',
266269
id: 'cdn-max-age-long-cc-max-age',
270+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
267271
cdn_only: true,
268272
depends_on: ['cdn-max-age'],
269273
requests: [
@@ -283,6 +287,7 @@ export default
283287
{
284288
name: 'CDN must not reuse a cached response with `CDN-Cache-Control: private`, even with `Cache-Control: max-age` and `Expires`',
285289
id: 'cdn-private',
290+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
286291
cdn_only: true,
287292
requests: [
288293
{
@@ -302,6 +307,7 @@ export default
302307
{
303308
name: 'CDN must not reuse a cached response with `CDN-Cache-Control: no-cache`, even with `Cache-Control: max-age` and `Expires`',
304309
id: 'cdn-no-cache',
310+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
305311
cdn_only: true,
306312
requests: [
307313
{
@@ -321,6 +327,7 @@ export default
321327
{
322328
name: 'CDN must not store a response with `CDN-Cache-Control: no-store`, even with `Cache-Control: max-age` and `Expires`',
323329
id: 'cdn-no-store-cc-fresh',
330+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
324331
cdn_only: true,
325332
depends_on: ['freshness-none'],
326333
requests: [
@@ -342,6 +349,7 @@ export default
342349
{
343350
name: 'An optimal CDN stores a response with a fresh `CDN-Cache-Control: max-age`, even with `Cache-Control: no-store`',
344351
id: 'cdn-fresh-cc-nostore',
352+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
345353
depends_on: ['freshness-none'],
346354
cdn_only: true,
347355
requests: [
@@ -361,6 +369,7 @@ export default
361369
{
362370
name: 'CDN should ignore a `CDN-Cache-Control` that\'s an invalid Structured Field (unknown type)',
363371
id: 'cdn-cc-invalid-sh-type-unknown',
372+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
364373
depends_on: ['cdn-max-age'],
365374
cdn_only: true,
366375
requests: [
@@ -380,6 +389,7 @@ export default
380389
{
381390
name: 'CDN should ignore a `CDN-Cache-Control` that\'s an invalid Structured Field (wrong type)',
382391
id: 'cdn-cc-invalid-sh-type-wrong',
392+
spec_anchors: ['https://www.rfc-editor.org/rfc/rfc9213.html'],
383393
depends_on: ['cdn-max-age'],
384394
cdn_only: true,
385395
requests: [

tests/conditional-etag.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export default {
3030
{
3131
name: 'HTTP cache must include `ETag` in a `304 Not Modified`',
3232
id: 'conditional-304-etag',
33+
spec_anchors: ['freshening.responses'],
3334
depends_on: ['conditional-etag-strong-respond'],
3435
browser_skip: true,
3536
requests: [
@@ -53,6 +54,7 @@ export default {
5354
{
5455
name: 'HTTP cache must give precedence to `If-None-Match` over `If-Modified-Since`',
5556
id: 'conditional-etag-precedence',
57+
spec_anchors: ['validation.received'],
5658
depends_on: ['conditional-etag-strong-respond'],
5759
browser_skip: true,
5860
requests: [
@@ -310,6 +312,7 @@ export default {
310312
{
311313
name: 'HTTP cache must include stored response headers identified by `Vary` in a conditional request it generates',
312314
id: 'conditional-etag-vary-headers',
315+
spec_anchors: ['validation.sent'],
313316
requests: [
314317
{
315318
request_headers: [
@@ -339,6 +342,7 @@ export default {
339342
{
340343
name: 'HTTP cache must not use a stored `ETag` to validate when the presented `Vary`ing request header differs',
341344
id: 'conditional-etag-vary-headers-mismatch',
345+
spec_anchors: ['caching.negotiated.responses'],
342346
depends_on: ['conditional-etag-vary-headers', 'vary-no-match'],
343347
requests: [
344348
{

tests/expires-freshness.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export default
2828
{
2929
name: 'HTTP cache must not reuse a response with a past `Expires`',
3030
id: 'freshness-expires-past',
31+
spec_anchors: ['calculating.freshness.lifetime'],
3132
depends_on: ['freshness-expires-future'],
3233
requests: [
3334
{
@@ -46,6 +47,7 @@ export default
4647
{
4748
name: 'HTTP cache must not reuse a response with a present `Expires`',
4849
id: 'freshness-expires-present',
50+
spec_anchors: ['calculating.freshness.lifetime'],
4951
depends_on: ['freshness-none'],
5052
requests: [
5153
{
@@ -63,6 +65,7 @@ export default
6365
{
6466
name: 'HTTP cache must not reuse a response with an `Expires` older than `Date`, both fast',
6567
id: 'freshness-expires-old-date',
68+
spec_anchors: ['calculating.freshness.lifetime'],
6669
depends_on: ['freshness-expires-future'],
6770
requests: [
6871
{
@@ -81,6 +84,7 @@ export default
8184
{
8285
name: 'HTTP cache must not reuse a response with an invalid `Expires` (0)',
8386
id: 'freshness-expires-invalid',
87+
spec_anchors: ['field.expires'],
8488
depends_on: ['freshness-expires-future'],
8589
requests: [
8690
{
@@ -117,6 +121,7 @@ export default
117121
{
118122
name: 'HTTP cache must not reuse a response when the `Age` header is greater than its `Expires` minus `Date`, and `Date` is slow',
119123
id: 'freshness-expires-age-slow-date',
124+
spec_anchors: ['calculating.freshness.lifetime'],
120125
depends_on: ['freshness-expires-future'],
121126
requests: [
122127
{
@@ -135,6 +140,7 @@ export default
135140
{
136141
name: 'HTTP cache must not reuse a response when the `Age` header is greater than its `Expires` minus `Date`, and `Date` is fast',
137142
id: 'freshness-expires-age-fast-date',
143+
spec_anchors: ['calculating.freshness.lifetime'],
138144
depends_on: ['freshness-expires-future'],
139145
requests: [
140146
{

tests/expires-parse.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export default
142142
{
143143
name: 'HTTP cache must not reuse a response with an invalid `Expires` (UTC)',
144144
id: 'freshness-expires-invalid-utc',
145+
spec_anchors: ['field.expires'],
145146
depends_on: ['freshness-expires-future'],
146147
requests: [
147148
{
@@ -160,6 +161,7 @@ export default
160161
{
161162
name: 'HTTP cache must not reuse a response with an invalid `Expires` (other tz)',
162163
id: 'freshness-expires-invalid-aest',
164+
spec_anchors: ['field.expires'],
163165
depends_on: ['freshness-expires-future'],
164166
requests: [
165167
{
@@ -178,6 +180,7 @@ export default
178180
{
179181
name: 'HTTP cache must not reuse a response with an invalid `Expires` (two-digit year)',
180182
id: 'freshness-expires-invalid-2-digit-year',
183+
spec_anchors: ['field.expires'],
181184
depends_on: ['freshness-expires-future'],
182185
requests: [
183186
{
@@ -196,6 +199,7 @@ export default
196199
{
197200
name: 'HTTP cache must not reuse a response with an invalid `Expires` (missing comma)',
198201
id: 'freshness-expires-invalid-no-comma',
202+
spec_anchors: ['field.expires'],
199203
depends_on: ['freshness-expires-future'],
200204
requests: [
201205
{
@@ -214,6 +218,7 @@ export default
214218
{
215219
name: 'HTTP cache must not reuse a response with an invalid `Expires` (multiple spaces)',
216220
id: 'freshness-expires-invalid-multiple-spaces',
221+
spec_anchors: ['field.expires'],
217222
depends_on: ['freshness-expires-future'],
218223
requests: [
219224
{
@@ -231,6 +236,7 @@ export default
231236
{
232237
name: 'HTTP cache must not reuse a response with an invalid `Expires` (date dashes)',
233238
id: 'freshness-expires-invalid-date-dashes',
239+
spec_anchors: ['field.expires'],
234240
depends_on: ['freshness-expires-future'],
235241
requests: [
236242
{
@@ -248,6 +254,7 @@ export default
248254
{
249255
name: 'HTTP cache must not reuse a response with an invalid `Expires` (time periods)',
250256
id: 'freshness-expires-invalid-time-periods',
257+
spec_anchors: ['field.expires'],
251258
depends_on: ['freshness-expires-future'],
252259
requests: [
253260
{
@@ -265,6 +272,7 @@ export default
265272
{
266273
name: 'HTTP cache must not reuse a response with an invalid `Expires` (1-digit hour)',
267274
id: 'freshness-expires-invalid-1-digit-hour',
275+
spec_anchors: ['field.expires'],
268276
depends_on: ['freshness-expires-future'],
269277
requests: [
270278
{
@@ -282,6 +290,7 @@ export default
282290
{
283291
name: 'HTTP cache must not reuse a response with an invalid `Expires` (multiple lines)',
284292
id: 'freshness-expires-invalid-multiple-lines',
293+
spec_anchors: ['field.expires'],
285294
depends_on: ['freshness-expires-future'],
286295
requests: [
287296
{

tests/headers.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const tests = []
77
tests.push({
88
name: '`Connection` header must inhibit a HTTP cache from storing listed headers',
99
id: 'headers-omit-headers-listed-in-Connection',
10+
spec_anchors: ['storing.fields'],
1011
kind: 'required',
1112
depends_on: ['freshness-max-age'],
1213
requests: [
@@ -46,6 +47,7 @@ function checkStoreHeader (config) {
4647
tests.push({
4748
name: `HTTP cache ${requirement} store \`${config.name}\` header field`,
4849
id: `headers-${id}`,
50+
spec_anchors: ['storing.fields'],
4951
kind: 'required',
5052
depends_on: ['freshness-max-age'],
5153
requests: [

0 commit comments

Comments
 (0)