Initial
This commit is contained in:
70
resources/app/node_modules/fresh/HISTORY.md
generated
vendored
Normal file
70
resources/app/node_modules/fresh/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
0.5.2 / 2017-09-13
|
||||
==================
|
||||
|
||||
* Fix regression matching multiple ETags in `If-None-Match`
|
||||
* perf: improve `If-None-Match` token parsing
|
||||
|
||||
0.5.1 / 2017-09-11
|
||||
==================
|
||||
|
||||
* Fix handling of modified headers with invalid dates
|
||||
* perf: improve ETag match loop
|
||||
|
||||
0.5.0 / 2017-02-21
|
||||
==================
|
||||
|
||||
* Fix incorrect result when `If-None-Match` has both `*` and ETags
|
||||
* Fix weak `ETag` matching to match spec
|
||||
* perf: delay reading header values until needed
|
||||
* perf: skip checking modified time if ETag check failed
|
||||
* perf: skip parsing `If-None-Match` when no `ETag` header
|
||||
* perf: use `Date.parse` instead of `new Date`
|
||||
|
||||
0.4.0 / 2017-02-05
|
||||
==================
|
||||
|
||||
* Fix false detection of `no-cache` request directive
|
||||
* perf: enable strict mode
|
||||
* perf: hoist regular expressions
|
||||
* perf: remove duplicate conditional
|
||||
* perf: remove unnecessary boolean coercions
|
||||
|
||||
0.3.0 / 2015-05-12
|
||||
==================
|
||||
|
||||
* Add weak `ETag` matching support
|
||||
|
||||
0.2.4 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Support Node.js 0.6
|
||||
|
||||
0.2.3 / 2014-09-07
|
||||
==================
|
||||
|
||||
* Move repository to jshttp
|
||||
|
||||
0.2.2 / 2014-02-19
|
||||
==================
|
||||
|
||||
* Revert "Fix for blank page on Safari reload"
|
||||
|
||||
0.2.1 / 2014-01-29
|
||||
==================
|
||||
|
||||
* Fix for blank page on Safari reload
|
||||
|
||||
0.2.0 / 2013-08-11
|
||||
==================
|
||||
|
||||
* Return stale for `Cache-Control: no-cache`
|
||||
|
||||
0.1.0 / 2012-06-15
|
||||
==================
|
||||
|
||||
* Add `If-None-Match: *` support
|
||||
|
||||
0.0.1 / 2012-06-10
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
resources/app/node_modules/fresh/LICENSE
generated
vendored
Normal file
23
resources/app/node_modules/fresh/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2016-2017 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
137
resources/app/node_modules/fresh/index.js
generated
vendored
Normal file
137
resources/app/node_modules/fresh/index.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/*!
|
||||
* fresh
|
||||
* Copyright(c) 2012 TJ Holowaychuk
|
||||
* Copyright(c) 2016-2017 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* RegExp to check for no-cache token in Cache-Control.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var CACHE_CONTROL_NO_CACHE_REGEXP = /(?:^|,)\s*?no-cache\s*?(?:,|$)/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = fresh
|
||||
|
||||
/**
|
||||
* Check freshness of the response using request and response headers.
|
||||
*
|
||||
* @param {Object} reqHeaders
|
||||
* @param {Object} resHeaders
|
||||
* @return {Boolean}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function fresh (reqHeaders, resHeaders) {
|
||||
// fields
|
||||
var modifiedSince = reqHeaders['if-modified-since']
|
||||
var noneMatch = reqHeaders['if-none-match']
|
||||
|
||||
// unconditional request
|
||||
if (!modifiedSince && !noneMatch) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Always return stale when Cache-Control: no-cache
|
||||
// to support end-to-end reload requests
|
||||
// https://tools.ietf.org/html/rfc2616#section-14.9.4
|
||||
var cacheControl = reqHeaders['cache-control']
|
||||
if (cacheControl && CACHE_CONTROL_NO_CACHE_REGEXP.test(cacheControl)) {
|
||||
return false
|
||||
}
|
||||
|
||||
// if-none-match
|
||||
if (noneMatch && noneMatch !== '*') {
|
||||
var etag = resHeaders['etag']
|
||||
|
||||
if (!etag) {
|
||||
return false
|
||||
}
|
||||
|
||||
var etagStale = true
|
||||
var matches = parseTokenList(noneMatch)
|
||||
for (var i = 0; i < matches.length; i++) {
|
||||
var match = matches[i]
|
||||
if (match === etag || match === 'W/' + etag || 'W/' + match === etag) {
|
||||
etagStale = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (etagStale) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// if-modified-since
|
||||
if (modifiedSince) {
|
||||
var lastModified = resHeaders['last-modified']
|
||||
var modifiedStale = !lastModified || !(parseHttpDate(lastModified) <= parseHttpDate(modifiedSince))
|
||||
|
||||
if (modifiedStale) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an HTTP Date into a number.
|
||||
*
|
||||
* @param {string} date
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseHttpDate (date) {
|
||||
var timestamp = date && Date.parse(date)
|
||||
|
||||
// istanbul ignore next: guard against date.js Date.parse patching
|
||||
return typeof timestamp === 'number'
|
||||
? timestamp
|
||||
: NaN
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a HTTP token list.
|
||||
*
|
||||
* @param {string} str
|
||||
* @private
|
||||
*/
|
||||
|
||||
function parseTokenList (str) {
|
||||
var end = 0
|
||||
var list = []
|
||||
var start = 0
|
||||
|
||||
// gather tokens
|
||||
for (var i = 0, len = str.length; i < len; i++) {
|
||||
switch (str.charCodeAt(i)) {
|
||||
case 0x20: /* */
|
||||
if (start === end) {
|
||||
start = end = i + 1
|
||||
}
|
||||
break
|
||||
case 0x2c: /* , */
|
||||
list.push(str.substring(start, end))
|
||||
start = end = i + 1
|
||||
break
|
||||
default:
|
||||
end = i + 1
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// final token
|
||||
list.push(str.substring(start, end))
|
||||
|
||||
return list
|
||||
}
|
||||
29
resources/app/node_modules/fresh/package.json
generated
vendored
Normal file
29
resources/app/node_modules/fresh/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "fresh",
|
||||
"description": "HTTP response freshness testing",
|
||||
"version": "0.5.2",
|
||||
"author": "TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com)",
|
||||
"license": "MIT",
|
||||
"repository": "jshttp/fresh",
|
||||
"devDependencies": {
|
||||
"beautify-benchmark": "0.2.4",
|
||||
"benchmark": "2.1.4",
|
||||
"eslint": "3.19.0",
|
||||
"eslint-config-standard": "10.2.1",
|
||||
"eslint-plugin-import": "2.7.0",
|
||||
"eslint-plugin-markdown": "1.0.0-beta.6",
|
||||
"eslint-plugin-node": "5.1.1",
|
||||
"eslint-plugin-promise": "3.5.0",
|
||||
"eslint-plugin-standard": "3.0.1",
|
||||
"istanbul": "0.4.5",
|
||||
"mocha": "1.21.5"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user