aboutsummaryrefslogtreecommitdiff
path: root/node_modules/fresh/index.js
diff options
context:
space:
mode:
authornanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-28 02:20:52 +0000
committernanalelfe <nargiza.nosirova@mail.utoronto.ca>2016-07-28 02:20:52 +0000
commit4cff38c8f7b65dab1fd72ea835ea7288327d1056 (patch)
treeac93acd69e77eef1e352af953d56238d70ea9c5d /node_modules/fresh/index.js
parente11dd98c9a55cd1742d221e3b1ea90d31e240fa8 (diff)
Fixed admin bug
Diffstat (limited to 'node_modules/fresh/index.js')
-rw-r--r--node_modules/fresh/index.js57
1 files changed, 0 insertions, 57 deletions
diff --git a/node_modules/fresh/index.js b/node_modules/fresh/index.js
deleted file mode 100644
index a900873..0000000
--- a/node_modules/fresh/index.js
+++ /dev/null
@@ -1,57 +0,0 @@
-
-/**
- * Expose `fresh()`.
- */
-
-module.exports = fresh;
-
-/**
- * Check freshness of `req` and `res` headers.
- *
- * When the cache is "fresh" __true__ is returned,
- * otherwise __false__ is returned to indicate that
- * the cache is now stale.
- *
- * @param {Object} req
- * @param {Object} res
- * @return {Boolean}
- * @api public
- */
-
-function fresh(req, res) {
- // defaults
- var etagMatches = true;
- var notModified = true;
-
- // fields
- var modifiedSince = req['if-modified-since'];
- var noneMatch = req['if-none-match'];
- var lastModified = res['last-modified'];
- var etag = res['etag'];
- var cc = req['cache-control'];
-
- // unconditional request
- if (!modifiedSince && !noneMatch) return false;
-
- // check for no-cache cache request directive
- if (cc && cc.indexOf('no-cache') !== -1) return false;
-
- // parse if-none-match
- if (noneMatch) noneMatch = noneMatch.split(/ *, */);
-
- // if-none-match
- if (noneMatch) {
- etagMatches = noneMatch.some(function (match) {
- return match === '*' || match === etag || match === 'W/' + etag;
- });
- }
-
- // if-modified-since
- if (modifiedSince) {
- modifiedSince = new Date(modifiedSince);
- lastModified = new Date(lastModified);
- notModified = lastModified <= modifiedSince;
- }
-
- return !! (etagMatches && notModified);
-}