Template Upload
This commit is contained in:
38
node_modules/fresh/HISTORY.md
generated
vendored
Normal file
38
node_modules/fresh/HISTORY.md
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
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
|
22
node_modules/fresh/LICENSE
generated
vendored
Normal file
22
node_modules/fresh/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
|
||||
|
||||
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.
|
58
node_modules/fresh/README.md
generated
vendored
Normal file
58
node_modules/fresh/README.md
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
# fresh
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
HTTP response freshness testing
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ npm install fresh
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var fresh = require('fresh')
|
||||
```
|
||||
|
||||
### fresh(req, res)
|
||||
|
||||
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.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var req = { 'if-none-match': 'tobi' };
|
||||
var res = { 'etag': 'luna' };
|
||||
fresh(req, res);
|
||||
// => false
|
||||
|
||||
var req = { 'if-none-match': 'tobi' };
|
||||
var res = { 'etag': 'tobi' };
|
||||
fresh(req, res);
|
||||
// => true
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/fresh.svg
|
||||
[npm-url]: https://npmjs.org/package/fresh
|
||||
[node-version-image]: https://img.shields.io/node/v/fresh.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/fresh/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/fresh
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/fresh/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/fresh?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/fresh.svg
|
||||
[downloads-url]: https://npmjs.org/package/fresh
|
57
node_modules/fresh/index.js
generated
vendored
Normal file
57
node_modules/fresh/index.js
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
112
node_modules/fresh/package.json
generated
vendored
Normal file
112
node_modules/fresh/package.json
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"fresh@^0.3.0",
|
||||
"C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\browser-sync-client"
|
||||
]
|
||||
],
|
||||
"_from": "fresh@>=0.3.0-0 <0.4.0-0",
|
||||
"_id": "fresh@0.3.0",
|
||||
"_inCache": true,
|
||||
"_location": "/fresh",
|
||||
"_npmUser": {
|
||||
"email": "doug@somethingdoug.com",
|
||||
"name": "dougwilson"
|
||||
},
|
||||
"_npmVersion": "1.4.28",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"name": "fresh",
|
||||
"raw": "fresh@^0.3.0",
|
||||
"rawSpec": "^0.3.0",
|
||||
"scope": null,
|
||||
"spec": ">=0.3.0-0 <0.4.0-0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browser-sync-client"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/fresh/-/fresh-0.3.0.tgz",
|
||||
"_shasum": "651f838e22424e7566de161d8358caa199f83d4f",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "fresh@^0.3.0",
|
||||
"_where": "C:\\Users\\x2mjbyrn\\Source\\Repos\\Skeleton\\node_modules\\browser-sync-client",
|
||||
"author": {
|
||||
"email": "tj@vision-media.ca",
|
||||
"name": "TJ Holowaychuk",
|
||||
"url": "http://tjholowaychuk.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/fresh/issues"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {},
|
||||
"description": "HTTP response freshness testing",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "1.21.5"
|
||||
},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "651f838e22424e7566de161d8358caa199f83d4f",
|
||||
"tarball": "https://registry.npmjs.org/fresh/-/fresh-0.3.0.tgz"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"gitHead": "14616c9748368ca08cd6a955dd88ab659b778634",
|
||||
"homepage": "https://github.com/jshttp/fresh",
|
||||
"installable": true,
|
||||
"keywords": [
|
||||
"cache",
|
||||
"conditional",
|
||||
"fresh",
|
||||
"http"
|
||||
],
|
||||
"license": "MIT",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "jonathanong",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
}
|
||||
],
|
||||
"name": "fresh",
|
||||
"optionalDependencies": {},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jshttp/fresh"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
},
|
||||
"version": "0.3.0"
|
||||
}
|
Reference in New Issue
Block a user