From 2edbdff86accb060c137a4f8a2ab3eb0aa9d2ce9 Mon Sep 17 00:00:00 2001 From: Mark Nottingham Date: Wed, 12 Jul 2023 12:31:59 +1000 Subject: [PATCH] Remove surrogate-control --- index.html | 2 - test-engine/cli.mjs | 3 - test-engine/export.mjs | 3 - test-engine/lib/header-fixup.mjs | 11 - tests/surrogate-control.mjs | 411 ------------------------------- 5 files changed, 430 deletions(-) delete mode 100644 tests/surrogate-control.mjs diff --git a/index.html b/index.html index 3736de8..5de2ffa 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,6 @@ import * as summary from './test-engine/lib/summary.mjs' import * as display from './test-engine/lib/display.mjs' import baseTests from './tests/index.mjs' - import surrogate from './tests/surrogate-control.mjs' const loc = new URL(window.location) const suiteIds = loc.searchParams.getAll('suite') @@ -31,7 +30,6 @@ document.querySelectorAll('.noFrame').forEach(e => {e.style.display = 'block'}) } - baseTests.push(surrogate) const ToC = document.getElementById('ToC') const target = document.getElementById('target') const key = document.getElementById('key') diff --git a/test-engine/cli.mjs b/test-engine/cli.mjs index 2eae09a..954f37d 100644 --- a/test-engine/cli.mjs +++ b/test-engine/cli.mjs @@ -3,9 +3,6 @@ import * as display from './lib/display.mjs' import { GREEN, NC } from './lib/defines.mjs' import fetch from 'node-fetch-with-proxy' import tests from '../tests/index.mjs' -import surrogate from '../tests/surrogate-control.mjs' - -tests.push(surrogate) const baseUrl = process.env.npm_config_base || process.env.npm_package_config_base const testId = process.env.npm_config_id || process.env.npm_package_config_id diff --git a/test-engine/export.mjs b/test-engine/export.mjs index 0b26070..27eec3a 100644 --- a/test-engine/export.mjs +++ b/test-engine/export.mjs @@ -3,9 +3,6 @@ import fs from 'fs' import Ajv from 'ajv' import tests from '../tests/index.mjs' -import surrogate from '../tests/surrogate-control.mjs' - -tests.push(surrogate) if (process.argv[2] === 'validate') { const ajv = new Ajv() diff --git a/test-engine/lib/header-fixup.mjs b/test-engine/lib/header-fixup.mjs index e3cf5e4..570e041 100644 --- a/test-engine/lib/header-fixup.mjs +++ b/test-engine/lib/header-fixup.mjs @@ -24,16 +24,5 @@ export function fixupHeader (header, respHeaders, reqConfig) { } } - // Surrogate-Control - const capabilitySeen = respHeaders['capability-seen'] - if (headerName === 'surrogate-control' && capabilitySeen) { - // right now we assume just one - const capabilityTarget = capabilitySeen.split('=')[0] - if (!capabilityTarget) { - console.error('WARN: Capability target is empty') - } - header[1] = header[1].replace('CAPABILITY_TARGET', capabilityTarget) - } - return header } diff --git a/tests/surrogate-control.mjs b/tests/surrogate-control.mjs deleted file mode 100644 index 8fd0df4..0000000 --- a/tests/surrogate-control.mjs +++ /dev/null @@ -1,411 +0,0 @@ -export default - -{ - name: 'Surrogate-Control', - id: 'surrogate-control', - description: 'These tests check non-browser caches for behaviours around the `Surrogate-Control` response header. It was [specified in a W3C Note](https://www.w3.org/TR/edge-arch/) a long time ago, but interoperability around it is not clear.', - tests: [ - { - name: 'An optimal surrogate cache reuses a response with positive `Surrogate-Control: max-age`', - id: 'surrogate-max-age', - browser_skip: true, - depends_on: ['freshness-none'], - kind: 'optimal', - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'max-age=3600', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'cached' - } - ] - }, - { - name: 'An optimal surrogate cache reuses a response with `Surrogate-Control: max-age: 2147483648`', - id: 'surrogate-max-age-max', - kind: 'optimal', - browser_skip: true, - depends_on: ['freshness-none'], - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'max-age=2147483648', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'cached' - } - ] - }, - { - name: 'An optimal surrogate cache reuses a response with `Surrogate-Control: max-age: 99999999999`', - id: 'surrogate-max-age-max-plus', - kind: 'optimal', - browser_skip: true, - depends_on: ['freshness-none'], - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'max-age=99999999999', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'cached' - } - ] - }, - { - name: 'An optimal surrogate cache reuses a response with `Surrogate-Control: max-age` targeted at it', - id: 'surrogate-max-age-me-target', - kind: 'optimal', - browser_skip: true, - depends_on: ['freshness-none'], - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'max-age=3600;CAPABILITY_TARGET', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'cached' - } - ] - }, - { - name: 'Surrogate cache must not reuse a response when `max-age` directive is targetted at another device', - id: 'surrogate-max-age-other-target', - browser_skip: true, - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Date', 0], - ['Surrogate-Control', 'max-age=3600;not-for-you', false], - ['Age', '7200'] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'not_cached' - } - ] - }, - { - name: 'Surrogate cache must not reuse a response when the `Age` header is greater than its `Surrogate-Control: max-age` freshness lifetime', - id: 'surrogate-max-age-age', - browser_skip: true, - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Date', 0], - ['Surrogate-Control', 'max-age=3600', false], - ['Age', '7200'] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'not_cached' - } - ] - }, - { - name: 'Does surrogate cache ignore `Surrogate-Control: max-age` with space before the `=`?', - id: 'surrogate-max-age-space-before-equals', - browser_skip: true, - kind: 'check', - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Cache-Control', 'max-age=1'], - ['Surrogate-Control', 'max-age =100', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'not_cached' - } - ] - }, - { - name: 'Does surrogate cache ignore `Surrogate-Control: max-age` with space after the `=`?', - id: 'surrogate-max-age-space-after-equals', - browser_skip: true, - kind: 'check', - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Cache-Control', 'max-age=1'], - ['Surrogate-Control', 'max-age= 100', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'not_cached' - } - ] - }, - { - name: 'Surrogate cache must not reuse a response with `Surrogate-Control: max-age=0`', - id: 'surrogate-max-age-0', - browser_skip: true, - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'max-age=0', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'not_cached' - } - ] - }, - { - name: 'An optimal surrogate cache reuses a response with a positive `Surrogate-Control: max-age` with an extension', - id: 'surrogate-max-age-extension', - browser_skip: true, - kind: 'optimal', - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'foobar, max-age=3600', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'cached' - } - ] - }, - { - name: 'An optimal surogate cache reuses a response with a positive `Surrogate-Control: MaX-aGe`', - id: 'surrogate-max-age-case-insensitive', - browser_skip: true, - kind: 'optimal', - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'MaX-aGe=3600', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'cached' - } - ] - }, - - { - name: 'An optimal surrogate cache reuses a response with a positive `Surrogate-Control: max-age` and a past `Expires`', - id: 'surrogate-max-age-expires', - browser_skip: true, - kind: 'optimal', - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'max-age=3600', false], - ['Expires', -10000], - ['Date', 0] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'cached' - } - ] - }, - { - name: 'An optimal surrogate cache reuses a response with a positive `Surrogate-Control: max-age` and an invalid `Expires`', - id: 'surrogate-max-age-cc-max-age-invalid-expires', - browser_skip: true, - kind: 'optimal', - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'max-age=3600', false], - ['Expires', '0', false], - ['Date', 0] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'cached' - } - ] - }, - { - name: 'Surrogate cache must not reuse a response with a `Surrogate-Control: max-age=0` and a future `Expires`', - id: 'surrogate-max-age-0-expires', - browser_skip: true, - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'max-age=0', false], - ['Expires', 10000], - ['Date', 0] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'not_cached' - } - ] - }, - { - name: 'An optimal surrogate cache prefers a long `Surrogate-Control: max-age` over a short `Cache-Control: max-age`', - id: 'surrogate-max-age-short-cc-max-age', - browser_skip: true, - kind: 'optimal', - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Cache-Control', 'max-age=1'], - ['Surrogate-Control', 'max-age=3600', false] - ], - pause_after: true, - setup: true - }, - { - expected_type: 'cached' - } - ] - }, - { - name: 'Surrogate cache must prefer a short `Surrogate-Control: max-age` over a long `Cache-Control: max-age`', - id: 'surrogate-max-age-long-cc-max-age', - browser_skip: true, - depends_on: ['surrogate-max-age'], - requests: [ - { - response_headers: [ - ['Cache-Control', 'max-age=3600'], - ['Surrogate-Control', 'max-age=1', false] - ], - pause_after: true, - setup: true - }, - { - expected_type: 'not_cached' - } - ] - }, - { - name: 'Surrogate cache must not store a response with `Surrogate-Control: no-store`', - id: 'surrogate-no-store', - browser_skip: true, - requests: [ - { - response_headers: [ - ['Surrogate-Control', 'no-store', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'not_cached' - } - ] - }, - { - name: 'Surrogate cache must not store a response with `Surrogate-Control: no-store`, even with `Cache-Control: max-age` and `Expires`', - id: 'surrogate-no-store-cc-fresh', - browser_skip: true, - depends_on: ['surrogate-no-store'], - requests: [ - { - response_headers: [ - ['Cache-Control', 'max-age=10000'], - ['Surrogate-Control', 'no-store', false], - ['Expires', 10000], - ['Date', 0] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'not_cached' - } - ] - }, - { - name: 'Does surrogate cache store a response with `Surrogate-Control: max-age`, even with `Cache-Control: no-store`?', - id: 'surrogate-fresh-cc-nostore', - browser_skip: true, - requests: [ - { - response_headers: [ - ['Cache-Control', 'no-store'], - ['Surrogate-Control', 'max-age=10000;CAPABILITY_TARGET', false] - ], - setup: true, - pause_after: true - }, - { - expected_type: 'cached' - } - ] - }, - { - name: 'Does the surrogate append the `Surrogate-Capability` request header?', - id: 'surrogate-append-capabilities', - browser_skip: true, - kind: 'check', - requests: [ - { - expected_request_headers: ['Surrogate-Capability'] - } - ] - }, - { - name: 'Does the surrogate forward the `Surrogate-Control` response header?', - id: 'surrogate-remove-header', - browser_skip: true, - kind: 'check', - requests: [ - { - // only check for the header in expected_response_headers, so failing - // this is an assertion failure and not a setup error - response_headers: [ - ['Cache-Control', 'max-age=10000'], - ['Surrogate-Control', 'foo', false], - ['Expires', 10000], - ['Date', 0] - ], - expected_response_headers: [ - ['Surrogate-Control', 'foo'] - ] - } - ] - } - ] -}