Skip to content

Commit 64b06ed

Browse files
wraithgarfritzy
authored andcommittedFeb 1, 2023
1 parent ad8deca commit 64b06ed

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed
 

‎node_modules/http-cache-semantics/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const statusCodeCacheableByDefault = new Set([
77
206,
88
300,
99
301,
10+
308,
1011
404,
1112
405,
1213
410,
@@ -79,10 +80,10 @@ function parseCacheControl(header) {
7980

8081
// 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),
8182
// the directive's value is considered invalid. Caches are encouraged to consider responses that have invalid freshness information to be stale
82-
const parts = header.trim().split(/\s*,\s*/); // TODO: lame parsing
83+
const parts = header.trim().split(/,/);
8384
for (const part of parts) {
84-
const [k, v] = part.split(/\s*=\s*/, 2);
85-
cc[k] = v === undefined ? true : v.replace(/^"|"$/g, ''); // TODO: lame unquoting
85+
const [k, v] = part.split(/=/, 2);
86+
cc[k.trim()] = v === undefined ? true : v.trim().replace(/^"|"$/g, '');
8687
}
8788

8889
return cc;
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "http-cache-semantics",
3-
"version": "4.1.0",
3+
"version": "4.1.1",
44
"description": "Parses Cache-Control and other headers. Helps building correct HTTP caches and proxies",
55
"repository": "https://github.com/kornelski/http-cache-semantics.git",
66
"main": "index.js",
@@ -13,12 +13,6 @@
1313
"author": "Kornel Lesiński <kornel@geekhood.net> (https://kornel.ski/)",
1414
"license": "BSD-2-Clause",
1515
"devDependencies": {
16-
"eslint": "^5.13.0",
17-
"eslint-plugin-prettier": "^3.0.1",
18-
"husky": "^0.14.3",
19-
"lint-staged": "^8.1.3",
20-
"mocha": "^5.1.0",
21-
"prettier": "^1.14.3",
22-
"prettier-eslint-cli": "^4.7.1"
16+
"mocha": "^10.0"
2317
}
2418
}

‎package-lock.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -5783,9 +5783,10 @@
57835783
}
57845784
},
57855785
"node_modules/http-cache-semantics": {
5786-
"version": "4.1.0",
5787-
"inBundle": true,
5788-
"license": "BSD-2-Clause"
5786+
"version": "4.1.1",
5787+
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",
5788+
"integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",
5789+
"inBundle": true
57895790
},
57905791
"node_modules/http-proxy": {
57915792
"version": "1.18.1",

0 commit comments

Comments
 (0)
Please sign in to comment.