Blob Blame History Raw
From 201c8b23df7bf986276e62b03f8276e18ef49728 Mon Sep 17 00:00:00 2001
From: Kornel <kornel@geekhood.net>
Date: Fri, 27 Jan 2023 01:20:38 +0000
Subject: [PATCH] deps(http-cache-semantics): Don't use regex to trim
 whitespace

upstream-patch: https://github.com/kornelski/http-cache-semantics/commit/560b2d8ef452bbba20ffed69dc155d63ac757b74
Signed-off-by: rpm-build <rpm-build>
---
 deps/npm/node_modules/http-cache-semantics/node4/index.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/deps/npm/node_modules/http-cache-semantics/node4/index.js b/deps/npm/node_modules/http-cache-semantics/node4/index.js
index bcdaebe..e427106 100644
--- a/deps/npm/node_modules/http-cache-semantics/node4/index.js
+++ b/deps/npm/node_modules/http-cache-semantics/node4/index.js
@@ -21,7 +21,7 @@ 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
-    var parts = header.trim().split(/\s*,\s*/); // TODO: lame parsing
+    var parts = header.trim().split(/,/);
     for (var _iterator = parts, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
         var _ref;
 
@@ -36,11 +36,11 @@ function parseCacheControl(header) {
 
         var part = _ref;
 
-        var _part$split = part.split(/\s*=\s*/, 2),
+        var _part$split = part.split(/=/, 2),
             k = _part$split[0],
             v = _part$split[1];
 
-        cc[k] = v === undefined ? true : v.replace(/^"|"$/g, ''); // TODO: lame unquoting
+        cc[k.trim()] = v === undefined ? true : v.trim().replace(/^"|"$/g, '');
     }
 
     return cc;
@@ -556,4 +556,4 @@ module.exports = function () {
     };
 
     return CachePolicy;
-}();
\ No newline at end of file
+}();
-- 
2.39.2