From c20dc7eeca608339143857953ee7ed9343fe6d3d Mon Sep 17 00:00:00 2001 From: Kornel Date: Thu, 14 Apr 2022 00:26:39 +0100 Subject: [PATCH 1/4] Cache 308 --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 4f6c2f3..050016a 100644 --- a/index.js +++ b/index.js @@ -7,6 +7,7 @@ const statusCodeCacheableByDefault = new Set([ 206, 300, 301, + 308, 404, 405, 410, From b1bdb92638426fab978f31e1330b6833015cabf0 Mon Sep 17 00:00:00 2001 From: Kornel Date: Fri, 27 Jan 2023 01:19:56 +0000 Subject: [PATCH 2/4] Remove linting package zoo --- .eslintrc.json | 3 +-- .huskyrc.json | 5 ----- .lintstagedrc.json | 3 --- package.json | 8 +------- 4 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 .huskyrc.json delete mode 100644 .lintstagedrc.json diff --git a/.eslintrc.json b/.eslintrc.json index defb3a1..54bb626 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,6 +3,5 @@ "node": true, "es6": true, "mocha": true - }, - "extends": ["plugin:prettier/recommended"] + } } diff --git a/.huskyrc.json b/.huskyrc.json deleted file mode 100644 index 5090235..0000000 --- a/.huskyrc.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "hooks": { - "pre-commit": "lint-staged" - } -} diff --git a/.lintstagedrc.json b/.lintstagedrc.json deleted file mode 100644 index abf245e..0000000 --- a/.lintstagedrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "*.{js,json,md,yml,yaml}": ["prettier-eslint --write", "git add"] -} diff --git a/package.json b/package.json index 897798d..5920c33 100644 --- a/package.json +++ b/package.json @@ -13,12 +13,6 @@ "author": "Kornel Lesiński (https://kornel.ski/)", "license": "BSD-2-Clause", "devDependencies": { - "eslint": "^5.13.0", - "eslint-plugin-prettier": "^3.0.1", - "husky": "^0.14.3", - "lint-staged": "^8.1.3", - "mocha": "^5.1.0", - "prettier": "^1.14.3", - "prettier-eslint-cli": "^4.7.1" + "mocha": "^5.1.0" } } From 560b2d8ef452bbba20ffed69dc155d63ac757b74 Mon Sep 17 00:00:00 2001 From: Kornel Date: Fri, 27 Jan 2023 01:20:38 +0000 Subject: [PATCH 3/4] Don't use regex to trim whitespace --- index.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 050016a..31fba48 100644 --- a/index.js +++ b/index.js @@ -80,10 +80,10 @@ function parseCacheControl(header) { // TODO: When there is more than one value present for a given directive (e.g., two Expires header fields, multiple Cache-Control: max-age directives), // the directive's value is considered invalid. Caches are encouraged to consider responses that have invalid freshness information to be stale - const parts = header.trim().split(/\s*,\s*/); // TODO: lame parsing + const parts = header.trim().split(/,/); for (const part of parts) { - const [k, v] = part.split(/\s*=\s*/, 2); - cc[k] = v === undefined ? true : v.replace(/^"|"$/g, ''); // TODO: lame unquoting + const [k, v] = part.split(/=/, 2); + cc[k.trim()] = v === undefined ? true : v.trim().replace(/^"|"$/g, ''); } return cc; diff --git a/package.json b/package.json index 5920c33..d3b590e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "http-cache-semantics", - "version": "4.1.0", + "version": "4.1.1", "description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies", "repository": "https://github.com/kornelski/http-cache-semantics.git", "main": "index.js", From 24496504352199caf360d1b4d4a01efdc8a7249e Mon Sep 17 00:00:00 2001 From: Kornel Date: Fri, 27 Jan 2023 01:21:59 +0000 Subject: [PATCH 4/4] Update mocha --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d3b590e..defbb04 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,6 @@ "author": "Kornel Lesiński (https://kornel.ski/)", "license": "BSD-2-Clause", "devDependencies": { - "mocha": "^5.1.0" + "mocha": "^10.0" } }