1er version du projet
This commit is contained in:
57
node_modules/cookie-parser/HISTORY.md
generated
vendored
Normal file
57
node_modules/cookie-parser/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
1.3.5 / 2015-05-19
|
||||
==================
|
||||
|
||||
* deps: cookie@0.1.3
|
||||
- Slight optimizations
|
||||
|
||||
1.3.4 / 2015-02-15
|
||||
==================
|
||||
|
||||
* deps: cookie-signature@1.0.6
|
||||
|
||||
1.3.3 / 2014-09-05
|
||||
==================
|
||||
|
||||
* deps: cookie-signature@1.0.5
|
||||
|
||||
1.3.2 / 2014-06-26
|
||||
==================
|
||||
|
||||
* deps: cookie-signature@1.0.4
|
||||
- fix for timing attacks
|
||||
|
||||
1.3.1 / 2014-06-17
|
||||
==================
|
||||
|
||||
* actually export `signedCookie`
|
||||
|
||||
1.3.0 / 2014-06-17
|
||||
==================
|
||||
|
||||
* add `signedCookie` export for single cookie unsigning
|
||||
|
||||
1.2.0 / 2014-06-17
|
||||
==================
|
||||
|
||||
* export parsing functions
|
||||
* `req.cookies` and `req.signedCookies` are now plain objects
|
||||
* slightly faster parsing of many cookies
|
||||
|
||||
1.1.0 / 2014-05-12
|
||||
==================
|
||||
|
||||
* Support for NodeJS version 0.8
|
||||
* deps: cookie@0.1.2
|
||||
- Fix for maxAge == 0
|
||||
- made compat with expires field
|
||||
- tweak maxAge NaN error message
|
||||
|
||||
1.0.1 / 2014-02-20
|
||||
==================
|
||||
|
||||
* add missing dependencies
|
||||
|
||||
1.0.0 / 2014-02-15
|
||||
==================
|
||||
|
||||
* Genesis from `connect`
|
||||
22
node_modules/cookie-parser/LICENSE
generated
vendored
Normal file
22
node_modules/cookie-parser/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 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.
|
||||
78
node_modules/cookie-parser/README.md
generated
vendored
Normal file
78
node_modules/cookie-parser/README.md
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
# cookie-parser
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Parse `Cookie` header and populate `req.cookies` with an object keyed by the cookie
|
||||
names. Optionally you may enable signed cookie support by passing a `secret` string,
|
||||
which assigns `req.secret` so it may be used by other middleware.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install cookie-parser
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var cookieParser = require('cookie-parser')
|
||||
|
||||
var app = express()
|
||||
app.use(cookieParser())
|
||||
```
|
||||
|
||||
### cookieParser(secret, options)
|
||||
|
||||
- `secret` a string used for signing cookies. This is optional and if not specified, will not parse signed cookies.
|
||||
- `options` an object that is passed to `cookie.parse` as the second option. See [cookie](https://www.npmjs.org/package/cookie) for more information.
|
||||
- `decode` a function to decode the value of the cookie
|
||||
|
||||
### cookieParser.JSONCookie(str)
|
||||
|
||||
Parse a cookie value as a JSON cookie. This will return the parsed JSON value if it was a JSON cookie, otherwise it will return the passed value.
|
||||
|
||||
### cookieParser.JSONCookies(cookies)
|
||||
|
||||
Given an object, this will iterate over the keys and call `JSONCookie` on each value. This will return the same object passed in.
|
||||
|
||||
### cookieParser.signedCookie(str, secret)
|
||||
|
||||
Parse a cookie value as a signed cookie. This will return the parsed unsigned value if it was a signed cookie and the signature was valid, otherwise it will return the passed value.
|
||||
|
||||
### cookieParser.signedCookies(cookies, secret)
|
||||
|
||||
Given an object, this will iterate over the keys and check if any value is a signed cookie. If it is a signed cookie and the signature is valid, the key will be deleted from the object and added to the new object that is returned.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var express = require('express')
|
||||
var cookieParser = require('cookie-parser')
|
||||
|
||||
var app = express()
|
||||
app.use(cookieParser())
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
console.log("Cookies: ", req.cookies)
|
||||
})
|
||||
|
||||
app.listen(8080)
|
||||
|
||||
// curl command that sends an HTTP request with two cookies
|
||||
// curl http://127.0.0.1:8080 --cookie "Cho=Kim;Greet=Hello"
|
||||
```
|
||||
|
||||
### [MIT Licensed](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/cookie-parser.svg
|
||||
[npm-url]: https://npmjs.org/package/cookie-parser
|
||||
[travis-image]: https://img.shields.io/travis/expressjs/cookie-parser/master.svg
|
||||
[travis-url]: https://travis-ci.org/expressjs/cookie-parser
|
||||
[coveralls-image]: https://img.shields.io/coveralls/expressjs/cookie-parser/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/expressjs/cookie-parser?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/cookie-parser.svg
|
||||
[downloads-url]: https://npmjs.org/package/cookie-parser
|
||||
59
node_modules/cookie-parser/index.js
generated
vendored
Normal file
59
node_modules/cookie-parser/index.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/*!
|
||||
* cookie-parser
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var cookie = require('cookie');
|
||||
var parse = require('./lib/parse');
|
||||
|
||||
/**
|
||||
* Parse Cookie header and populate `req.cookies`
|
||||
* with an object keyed by the cookie names.
|
||||
*
|
||||
* @param {String} [secret]
|
||||
* @param {Object} [options]
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
exports = module.exports = function cookieParser(secret, options){
|
||||
return function cookieParser(req, res, next) {
|
||||
if (req.cookies) return next();
|
||||
var cookies = req.headers.cookie;
|
||||
|
||||
req.secret = secret;
|
||||
req.cookies = Object.create(null);
|
||||
req.signedCookies = Object.create(null);
|
||||
|
||||
// no cookies
|
||||
if (!cookies) {
|
||||
return next();
|
||||
}
|
||||
|
||||
req.cookies = cookie.parse(cookies, options);
|
||||
|
||||
// parse signed cookies
|
||||
if (secret) {
|
||||
req.signedCookies = parse.signedCookies(req.cookies, secret);
|
||||
req.signedCookies = parse.JSONCookies(req.signedCookies);
|
||||
}
|
||||
|
||||
// parse JSON cookies
|
||||
req.cookies = parse.JSONCookies(req.cookies);
|
||||
|
||||
next();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Export parsing functions.
|
||||
*/
|
||||
|
||||
exports.JSONCookie = parse.JSONCookie;
|
||||
exports.JSONCookies = parse.JSONCookies;
|
||||
exports.signedCookie = parse.signedCookie;
|
||||
exports.signedCookies = parse.signedCookies;
|
||||
90
node_modules/cookie-parser/lib/parse.js
generated
vendored
Normal file
90
node_modules/cookie-parser/lib/parse.js
generated
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
var signature = require('cookie-signature');
|
||||
|
||||
/**
|
||||
* Parse signed cookies, returning an object
|
||||
* containing the decoded key/value pairs,
|
||||
* while removing the signed key from `obj`.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.signedCookies = function(obj, secret){
|
||||
var cookies = Object.keys(obj);
|
||||
var dec;
|
||||
var key;
|
||||
var ret = Object.create(null);
|
||||
var val;
|
||||
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
key = cookies[i];
|
||||
val = obj[key];
|
||||
dec = exports.signedCookie(val, secret);
|
||||
|
||||
if (val !== dec) {
|
||||
ret[key] = dec;
|
||||
delete obj[key];
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse a signed cookie string, return the decoded value
|
||||
*
|
||||
* @param {String} str signed cookie string
|
||||
* @param {String} secret
|
||||
* @return {String} decoded value
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.signedCookie = function(str, secret){
|
||||
return str.substr(0, 2) === 's:'
|
||||
? signature.unsign(str.slice(2), secret)
|
||||
: str;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse JSON cookies.
|
||||
*
|
||||
* @param {Object} obj
|
||||
* @return {Object}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.JSONCookies = function(obj){
|
||||
var cookies = Object.keys(obj);
|
||||
var key;
|
||||
var val;
|
||||
|
||||
for (var i = 0; i < cookies.length; i++) {
|
||||
key = cookies[i];
|
||||
val = exports.JSONCookie(obj[key]);
|
||||
|
||||
if (val) {
|
||||
obj[key] = val;
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse JSON cookie string
|
||||
*
|
||||
* @param {String} str
|
||||
* @return {Object} Parsed object or null if not json cookie
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.JSONCookie = function(str) {
|
||||
if (!str || str.substr(0, 2) !== 'j:') return;
|
||||
|
||||
try {
|
||||
return JSON.parse(str.slice(2));
|
||||
} catch (err) {
|
||||
// no op
|
||||
}
|
||||
};
|
||||
4
node_modules/cookie-parser/node_modules/cookie-signature/.npmignore
generated
vendored
Normal file
4
node_modules/cookie-parser/node_modules/cookie-signature/.npmignore
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
support
|
||||
test
|
||||
examples
|
||||
*.sock
|
||||
38
node_modules/cookie-parser/node_modules/cookie-signature/History.md
generated
vendored
Normal file
38
node_modules/cookie-parser/node_modules/cookie-signature/History.md
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
1.0.6 / 2015-02-03
|
||||
==================
|
||||
|
||||
* use `npm test` instead of `make test` to run tests
|
||||
* clearer assertion messages when checking input
|
||||
|
||||
|
||||
1.0.5 / 2014-09-05
|
||||
==================
|
||||
|
||||
* add license to package.json
|
||||
|
||||
1.0.4 / 2014-06-25
|
||||
==================
|
||||
|
||||
* corrected avoidance of timing attacks (thanks @tenbits!)
|
||||
|
||||
1.0.3 / 2014-01-28
|
||||
==================
|
||||
|
||||
* [incorrect] fix for timing attacks
|
||||
|
||||
1.0.2 / 2014-01-28
|
||||
==================
|
||||
|
||||
* fix missing repository warning
|
||||
* fix typo in test
|
||||
|
||||
1.0.1 / 2013-04-15
|
||||
==================
|
||||
|
||||
* Revert "Changed underlying HMAC algo. to sha512."
|
||||
* Revert "Fix for timing attacks on MAC verification."
|
||||
|
||||
0.0.1 / 2010-01-03
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
42
node_modules/cookie-parser/node_modules/cookie-signature/Readme.md
generated
vendored
Normal file
42
node_modules/cookie-parser/node_modules/cookie-signature/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
# cookie-signature
|
||||
|
||||
Sign and unsign cookies.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var cookie = require('cookie-signature');
|
||||
|
||||
var val = cookie.sign('hello', 'tobiiscool');
|
||||
val.should.equal('hello.DGDUkGlIkCzPz+C0B064FNgHdEjox7ch8tOBGslZ5QI');
|
||||
|
||||
var val = cookie.sign('hello', 'tobiiscool');
|
||||
cookie.unsign(val, 'tobiiscool').should.equal('hello');
|
||||
cookie.unsign(val, 'luna').should.be.false;
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 LearnBoost <tj@learnboost.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.
|
||||
51
node_modules/cookie-parser/node_modules/cookie-signature/index.js
generated
vendored
Normal file
51
node_modules/cookie-parser/node_modules/cookie-signature/index.js
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var crypto = require('crypto');
|
||||
|
||||
/**
|
||||
* Sign the given `val` with `secret`.
|
||||
*
|
||||
* @param {String} val
|
||||
* @param {String} secret
|
||||
* @return {String}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.sign = function(val, secret){
|
||||
if ('string' != typeof val) throw new TypeError("Cookie value must be provided as a string.");
|
||||
if ('string' != typeof secret) throw new TypeError("Secret string must be provided.");
|
||||
return val + '.' + crypto
|
||||
.createHmac('sha256', secret)
|
||||
.update(val)
|
||||
.digest('base64')
|
||||
.replace(/\=+$/, '');
|
||||
};
|
||||
|
||||
/**
|
||||
* Unsign and decode the given `val` with `secret`,
|
||||
* returning `false` if the signature is invalid.
|
||||
*
|
||||
* @param {String} val
|
||||
* @param {String} secret
|
||||
* @return {String|Boolean}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
exports.unsign = function(val, secret){
|
||||
if ('string' != typeof val) throw new TypeError("Signed cookie string must be provided.");
|
||||
if ('string' != typeof secret) throw new TypeError("Secret string must be provided.");
|
||||
var str = val.slice(0, val.lastIndexOf('.'))
|
||||
, mac = exports.sign(str, secret);
|
||||
|
||||
return sha1(mac) == sha1(val) ? str : false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Private
|
||||
*/
|
||||
|
||||
function sha1(str){
|
||||
return crypto.createHash('sha1').update(str).digest('hex');
|
||||
}
|
||||
59
node_modules/cookie-parser/node_modules/cookie-signature/package.json
generated
vendored
Normal file
59
node_modules/cookie-parser/node_modules/cookie-signature/package.json
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "cookie-signature",
|
||||
"version": "1.0.6",
|
||||
"description": "Sign and unsign cookies",
|
||||
"keywords": [
|
||||
"cookie",
|
||||
"sign",
|
||||
"unsign"
|
||||
],
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@learnboost.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/visionmedia/node-cookie-signature.git"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"should": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --require should --reporter spec"
|
||||
},
|
||||
"main": "index",
|
||||
"gitHead": "391b56cf44d88c493491b7e3fc53208cfb976d2a",
|
||||
"bugs": {
|
||||
"url": "https://github.com/visionmedia/node-cookie-signature/issues"
|
||||
},
|
||||
"homepage": "https://github.com/visionmedia/node-cookie-signature",
|
||||
"_id": "cookie-signature@1.0.6",
|
||||
"_shasum": "e303a882b342cc3ee8ca513a79999734dab3ae2c",
|
||||
"_from": "cookie-signature@1.0.6",
|
||||
"_npmVersion": "2.3.0",
|
||||
"_nodeVersion": "0.10.36",
|
||||
"_npmUser": {
|
||||
"name": "natevw",
|
||||
"email": "natevw@yahoo.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "natevw",
|
||||
"email": "natevw@yahoo.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "e303a882b342cc3ee8ca513a79999734dab3ae2c",
|
||||
"tarball": "http://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
23
node_modules/cookie-parser/node_modules/cookie/LICENSE
generated
vendored
Normal file
23
node_modules/cookie-parser/node_modules/cookie/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012-2014 Roman Shtylman <shtylman@gmail.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.
|
||||
|
||||
64
node_modules/cookie-parser/node_modules/cookie/README.md
generated
vendored
Normal file
64
node_modules/cookie-parser/node_modules/cookie/README.md
generated
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
# cookie
|
||||
|
||||
[![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]
|
||||
|
||||
cookie is a basic cookie parser and serializer. It doesn't make assumptions about how you are going to deal with your cookies. It basically just provides a way to read and write the HTTP cookie headers.
|
||||
|
||||
See [RFC6265](http://tools.ietf.org/html/rfc6265) for details about the http header for cookies.
|
||||
|
||||
## how?
|
||||
|
||||
```
|
||||
npm install cookie
|
||||
```
|
||||
|
||||
```javascript
|
||||
var cookie = require('cookie');
|
||||
|
||||
var hdr = cookie.serialize('foo', 'bar');
|
||||
// hdr = 'foo=bar';
|
||||
|
||||
var cookies = cookie.parse('foo=bar; cat=meow; dog=ruff');
|
||||
// cookies = { foo: 'bar', cat: 'meow', dog: 'ruff' };
|
||||
```
|
||||
|
||||
## more
|
||||
|
||||
The serialize function takes a third parameter, an object, to set cookie options. See the RFC for valid values.
|
||||
|
||||
### path
|
||||
> cookie path
|
||||
|
||||
### expires
|
||||
> absolute expiration date for the cookie (Date object)
|
||||
|
||||
### maxAge
|
||||
> relative max age of the cookie from when the client receives it (seconds)
|
||||
|
||||
### domain
|
||||
> domain for the cookie
|
||||
|
||||
### secure
|
||||
> true or false
|
||||
|
||||
### httpOnly
|
||||
> true or false
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/cookie.svg
|
||||
[npm-url]: https://npmjs.org/package/cookie
|
||||
[node-version-image]: https://img.shields.io/node/v/cookie.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/cookie/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/cookie
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/cookie/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/cookie?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/cookie.svg
|
||||
[downloads-url]: https://npmjs.org/package/cookie
|
||||
116
node_modules/cookie-parser/node_modules/cookie/index.js
generated
vendored
Normal file
116
node_modules/cookie-parser/node_modules/cookie/index.js
generated
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
/*!
|
||||
* cookie
|
||||
* Copyright(c) 2012-2014 Roman Shtylman
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
exports.parse = parse;
|
||||
exports.serialize = serialize;
|
||||
|
||||
/**
|
||||
* Module variables.
|
||||
* @private
|
||||
*/
|
||||
|
||||
var decode = decodeURIComponent;
|
||||
var encode = encodeURIComponent;
|
||||
|
||||
/**
|
||||
* Parse a cookie header.
|
||||
*
|
||||
* Parse the given cookie header string into an object
|
||||
* The object has the various cookies as keys(names) => values
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {object} [options]
|
||||
* @return {string}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function parse(str, options) {
|
||||
var obj = {}
|
||||
var opt = options || {};
|
||||
var pairs = str.split(/; */);
|
||||
var dec = opt.decode || decode;
|
||||
|
||||
pairs.forEach(function(pair) {
|
||||
var eq_idx = pair.indexOf('=')
|
||||
|
||||
// skip things that don't look like key=value
|
||||
if (eq_idx < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
var key = pair.substr(0, eq_idx).trim()
|
||||
var val = pair.substr(++eq_idx, pair.length).trim();
|
||||
|
||||
// quoted values
|
||||
if ('"' == val[0]) {
|
||||
val = val.slice(1, -1);
|
||||
}
|
||||
|
||||
// only assign once
|
||||
if (undefined == obj[key]) {
|
||||
obj[key] = tryDecode(val, dec);
|
||||
}
|
||||
});
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize data into a cookie header.
|
||||
*
|
||||
* Serialize the a name value pair into a cookie string suitable for
|
||||
* http headers. An optional options object specified cookie parameters.
|
||||
*
|
||||
* serialize('foo', 'bar', { httpOnly: true })
|
||||
* => "foo=bar; httpOnly"
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {string} val
|
||||
* @param {object} [options]
|
||||
* @return {string}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function serialize(name, val, options) {
|
||||
var opt = options || {};
|
||||
var enc = opt.encode || encode;
|
||||
var pairs = [name + '=' + enc(val)];
|
||||
|
||||
if (null != opt.maxAge) {
|
||||
var maxAge = opt.maxAge - 0;
|
||||
if (isNaN(maxAge)) throw new Error('maxAge should be a Number');
|
||||
pairs.push('Max-Age=' + maxAge);
|
||||
}
|
||||
|
||||
if (opt.domain) pairs.push('Domain=' + opt.domain);
|
||||
if (opt.path) pairs.push('Path=' + opt.path);
|
||||
if (opt.expires) pairs.push('Expires=' + opt.expires.toUTCString());
|
||||
if (opt.httpOnly) pairs.push('HttpOnly');
|
||||
if (opt.secure) pairs.push('Secure');
|
||||
|
||||
return pairs.join('; ');
|
||||
}
|
||||
|
||||
/**
|
||||
* Try decoding a string using a decoding function.
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {function} decode
|
||||
* @private
|
||||
*/
|
||||
|
||||
function tryDecode(str, decode) {
|
||||
try {
|
||||
return decode(str);
|
||||
} catch (e) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
69
node_modules/cookie-parser/node_modules/cookie/package.json
generated
vendored
Normal file
69
node_modules/cookie-parser/node_modules/cookie/package.json
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
{
|
||||
"name": "cookie",
|
||||
"description": "cookie parsing and serialization",
|
||||
"version": "0.1.3",
|
||||
"author": {
|
||||
"name": "Roman Shtylman",
|
||||
"email": "shtylman@gmail.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"cookie",
|
||||
"cookies"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/jshttp/cookie"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "1.x.x"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": "*"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
|
||||
},
|
||||
"gitHead": "f46097723c16f920a7b9759e154c34792e1d1a3b",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/cookie/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jshttp/cookie",
|
||||
"_id": "cookie@0.1.3",
|
||||
"_shasum": "e734a5c1417fce472d5aef82c381cabb64d1a435",
|
||||
"_from": "cookie@0.1.3",
|
||||
"_npmVersion": "1.4.28",
|
||||
"_npmUser": {
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "defunctzombie",
|
||||
"email": "shtylman@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "e734a5c1417fce472d5aef82c381cabb64d1a435",
|
||||
"tarball": "http://registry.npmjs.org/cookie/-/cookie-0.1.3.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/cookie/-/cookie-0.1.3.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
72
node_modules/cookie-parser/package.json
generated
vendored
Normal file
72
node_modules/cookie-parser/package.json
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "cookie-parser",
|
||||
"description": "cookie parsing with signatures",
|
||||
"version": "1.3.5",
|
||||
"author": {
|
||||
"name": "TJ Holowaychuk",
|
||||
"email": "tj@vision-media.ca",
|
||||
"url": "http://tjholowaychuk.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/expressjs/cookie-parser"
|
||||
},
|
||||
"keywords": [
|
||||
"cookie",
|
||||
"middleware"
|
||||
],
|
||||
"dependencies": {
|
||||
"cookie": "0.1.3",
|
||||
"cookie-signature": "1.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "2.2.5",
|
||||
"supertest": "1.0.1"
|
||||
},
|
||||
"files": [
|
||||
"lib/",
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8.0"
|
||||
},
|
||||
"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/"
|
||||
},
|
||||
"gitHead": "8133968c429c3f48eb8e3ed54932c52743ac9034",
|
||||
"bugs": {
|
||||
"url": "https://github.com/expressjs/cookie-parser/issues"
|
||||
},
|
||||
"homepage": "https://github.com/expressjs/cookie-parser",
|
||||
"_id": "cookie-parser@1.3.5",
|
||||
"_shasum": "9d755570fb5d17890771227a02314d9be7cf8356",
|
||||
"_from": "cookie-parser@>=1.3.5 <1.4.0",
|
||||
"_npmVersion": "1.4.28",
|
||||
"_npmUser": {
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "defunctzombie",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "9d755570fb5d17890771227a02314d9be7cf8356",
|
||||
"tarball": "http://registry.npmjs.org/cookie-parser/-/cookie-parser-1.3.5.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.3.5.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
Reference in New Issue
Block a user