Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- 220-Advanced-Summer-2019-master/students/PeterB/Lesson09/assignment/data/furniture/chair/couch/sofa_400_clr_10056.png +3 -0
- 220-Advanced-Summer-2019-master/students/PeterB/Lesson09/assignment/data/furniture/table/table_with_cloth_400_clr_10664.png +3 -0
- 220-Advanced-Summer-2019-master/students/PeterB/Lesson09/assignment/data/new/hotel_room_400_clr_12721.png +3 -0
- 220-Advanced-Summer-2019-master/students/Ron_Nair/lesson09/assignment/data/furniture/chair/couch/sofa_400_clr_10056.png +3 -0
- 220-Advanced-Summer-2019-master/students/charlie_england/lesson09/assignment/data/old/couple_on_swing_bench_400_clr_12844.png +3 -0
- 220-Advanced-Summer-2019-master/students/charlie_england/lesson09/assignment/data/old/sitting_in_chair_relaxing_400_clr_6028.png +3 -0
- 220-Advanced-Summer-2019-master/students/colephalen/lesson09/assignment/data/furniture/chair/couch/sofa_400_clr_10056.png +3 -0
- 220-Advanced-Summer-2019-master/students/colephalen/lesson09/assignment/data/old/sitting_in_chair_relaxing_400_clr_6028.png +3 -0
- 220-Advanced-Summer-2019-master/students/rimlee_talukdar/lesson09/assignment/data/furniture/chair/couch/sofa_400_clr_10056.png +3 -0
- 5485-master/demos/node_modules/express/node_modules/send/node_modules/mime/build/build.js +11 -0
- 5485-master/demos/node_modules/express/node_modules/send/node_modules/mime/build/test.js +57 -0
- 5485-master/demos/node_modules/express/node_modules/send/node_modules/ms/README.md +35 -0
- 5485-master/demos/node_modules/express/node_modules/send/node_modules/ms/package.json +48 -0
- 5485-master/demos/node_modules/express/node_modules/serve-static/README.md +216 -0
- 5485-master/demos/node_modules/express/node_modules/serve-static/index.js +138 -0
- 5485-master/demos/node_modules/express/node_modules/serve-static/package.json +84 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/LICENSE +21 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/README.md +117 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/index.js +224 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/HISTORY.md +22 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/LICENSE +22 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/README.md +81 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/index.js +270 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/package.json +58 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/HISTORY.md +103 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/LICENSE +22 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/README.md +102 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/index.js +63 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/HISTORY.md +195 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/LICENSE +22 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/README.md +76 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/db.json +0 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/index.js +11 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/package.json +94 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/package.json +84 -0
- 5485-master/demos/node_modules/express/node_modules/type-is/package.json +93 -0
- 5485-master/demos/node_modules/express/node_modules/utils-merge/.travis.yml +6 -0
- 5485-master/demos/node_modules/express/node_modules/utils-merge/LICENSE +20 -0
- 5485-master/demos/node_modules/express/node_modules/utils-merge/README.md +34 -0
- 5485-master/demos/node_modules/express/node_modules/utils-merge/index.js +23 -0
- 5485-master/demos/node_modules/express/node_modules/utils-merge/package.json +60 -0
- 5485-master/demos/node_modules/express/node_modules/vary/.npmignore +3 -0
- 5485-master/demos/node_modules/express/node_modules/vary/History.md +16 -0
- 5485-master/demos/node_modules/express/node_modules/vary/LICENSE +22 -0
- 5485-master/demos/node_modules/express/node_modules/vary/README.md +59 -0
- 5485-master/demos/node_modules/express/node_modules/vary/index.js +112 -0
- 5485-master/demos/node_modules/express/node_modules/vary/package.json +71 -0
- 5485-master/demos/node_modules/method-override/HISTORY.md +97 -0
- 5485-master/demos/node_modules/method-override/LICENSE +23 -0
- 5485-master/demos/node_modules/method-override/README.md +173 -0
220-Advanced-Summer-2019-master/students/PeterB/Lesson09/assignment/data/furniture/chair/couch/sofa_400_clr_10056.png
ADDED
|
Git LFS Details
|
220-Advanced-Summer-2019-master/students/PeterB/Lesson09/assignment/data/furniture/table/table_with_cloth_400_clr_10664.png
ADDED
|
Git LFS Details
|
220-Advanced-Summer-2019-master/students/PeterB/Lesson09/assignment/data/new/hotel_room_400_clr_12721.png
ADDED
|
Git LFS Details
|
220-Advanced-Summer-2019-master/students/Ron_Nair/lesson09/assignment/data/furniture/chair/couch/sofa_400_clr_10056.png
ADDED
|
Git LFS Details
|
220-Advanced-Summer-2019-master/students/charlie_england/lesson09/assignment/data/old/couple_on_swing_bench_400_clr_12844.png
ADDED
|
Git LFS Details
|
220-Advanced-Summer-2019-master/students/charlie_england/lesson09/assignment/data/old/sitting_in_chair_relaxing_400_clr_6028.png
ADDED
|
Git LFS Details
|
220-Advanced-Summer-2019-master/students/colephalen/lesson09/assignment/data/furniture/chair/couch/sofa_400_clr_10056.png
ADDED
|
Git LFS Details
|
220-Advanced-Summer-2019-master/students/colephalen/lesson09/assignment/data/old/sitting_in_chair_relaxing_400_clr_6028.png
ADDED
|
Git LFS Details
|
220-Advanced-Summer-2019-master/students/rimlee_talukdar/lesson09/assignment/data/furniture/chair/couch/sofa_400_clr_10056.png
ADDED
|
Git LFS Details
|
5485-master/demos/node_modules/express/node_modules/send/node_modules/mime/build/build.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
var db = require('mime-db');
|
| 2 |
+
|
| 3 |
+
var mapByType = {};
|
| 4 |
+
Object.keys(db).forEach(function(key) {
|
| 5 |
+
var extensions = db[key].extensions;
|
| 6 |
+
if (extensions) {
|
| 7 |
+
mapByType[key] = extensions;
|
| 8 |
+
}
|
| 9 |
+
});
|
| 10 |
+
|
| 11 |
+
console.log(JSON.stringify(mapByType));
|
5485-master/demos/node_modules/express/node_modules/send/node_modules/mime/build/test.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Usage: node test.js
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
var mime = require('../mime');
|
| 6 |
+
var assert = require('assert');
|
| 7 |
+
var path = require('path');
|
| 8 |
+
|
| 9 |
+
//
|
| 10 |
+
// Test mime lookups
|
| 11 |
+
//
|
| 12 |
+
|
| 13 |
+
assert.equal('text/plain', mime.lookup('text.txt')); // normal file
|
| 14 |
+
assert.equal('text/plain', mime.lookup('TEXT.TXT')); // uppercase
|
| 15 |
+
assert.equal('text/plain', mime.lookup('dir/text.txt')); // dir + file
|
| 16 |
+
assert.equal('text/plain', mime.lookup('.text.txt')); // hidden file
|
| 17 |
+
assert.equal('text/plain', mime.lookup('.txt')); // nameless
|
| 18 |
+
assert.equal('text/plain', mime.lookup('txt')); // extension-only
|
| 19 |
+
assert.equal('text/plain', mime.lookup('/txt')); // extension-less ()
|
| 20 |
+
assert.equal('text/plain', mime.lookup('\\txt')); // Windows, extension-less
|
| 21 |
+
assert.equal('application/octet-stream', mime.lookup('text.nope')); // unrecognized
|
| 22 |
+
assert.equal('fallback', mime.lookup('text.fallback', 'fallback')); // alternate default
|
| 23 |
+
|
| 24 |
+
//
|
| 25 |
+
// Test extensions
|
| 26 |
+
//
|
| 27 |
+
|
| 28 |
+
assert.equal('txt', mime.extension(mime.types.text));
|
| 29 |
+
assert.equal('html', mime.extension(mime.types.htm));
|
| 30 |
+
assert.equal('bin', mime.extension('application/octet-stream'));
|
| 31 |
+
assert.equal('bin', mime.extension('application/octet-stream '));
|
| 32 |
+
assert.equal('html', mime.extension(' text/html; charset=UTF-8'));
|
| 33 |
+
assert.equal('html', mime.extension('text/html; charset=UTF-8 '));
|
| 34 |
+
assert.equal('html', mime.extension('text/html; charset=UTF-8'));
|
| 35 |
+
assert.equal('html', mime.extension('text/html ; charset=UTF-8'));
|
| 36 |
+
assert.equal('html', mime.extension('text/html;charset=UTF-8'));
|
| 37 |
+
assert.equal('html', mime.extension('text/Html;charset=UTF-8'));
|
| 38 |
+
assert.equal(undefined, mime.extension('unrecognized'));
|
| 39 |
+
|
| 40 |
+
//
|
| 41 |
+
// Test node.types lookups
|
| 42 |
+
//
|
| 43 |
+
|
| 44 |
+
assert.equal('application/font-woff', mime.lookup('file.woff'));
|
| 45 |
+
assert.equal('application/octet-stream', mime.lookup('file.buffer'));
|
| 46 |
+
assert.equal('audio/mp4', mime.lookup('file.m4a'));
|
| 47 |
+
assert.equal('font/opentype', mime.lookup('file.otf'));
|
| 48 |
+
|
| 49 |
+
//
|
| 50 |
+
// Test charsets
|
| 51 |
+
//
|
| 52 |
+
|
| 53 |
+
assert.equal('UTF-8', mime.charsets.lookup('text/plain'));
|
| 54 |
+
assert.equal(undefined, mime.charsets.lookup(mime.types.js));
|
| 55 |
+
assert.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback'));
|
| 56 |
+
|
| 57 |
+
console.log('\nAll tests passed');
|
5485-master/demos/node_modules/express/node_modules/send/node_modules/ms/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ms.js: miliseconds conversion utility
|
| 2 |
+
|
| 3 |
+
```js
|
| 4 |
+
ms('2 days') // 172800000
|
| 5 |
+
ms('1d') // 86400000
|
| 6 |
+
ms('10h') // 36000000
|
| 7 |
+
ms('2.5 hrs') // 9000000
|
| 8 |
+
ms('2h') // 7200000
|
| 9 |
+
ms('1m') // 60000
|
| 10 |
+
ms('5s') // 5000
|
| 11 |
+
ms('100') // 100
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
```js
|
| 15 |
+
ms(60000) // "1m"
|
| 16 |
+
ms(2 * 60000) // "2m"
|
| 17 |
+
ms(ms('10 hours')) // "10h"
|
| 18 |
+
```
|
| 19 |
+
|
| 20 |
+
```js
|
| 21 |
+
ms(60000, { long: true }) // "1 minute"
|
| 22 |
+
ms(2 * 60000, { long: true }) // "2 minutes"
|
| 23 |
+
ms(ms('10 hours'), { long: true }) // "10 hours"
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
- Node/Browser compatible. Published as [`ms`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download).
|
| 27 |
+
- If a number is supplied to `ms`, a string with a unit is returned.
|
| 28 |
+
- If a string that contains the number is supplied, it returns it as
|
| 29 |
+
a number (e.g: it returns `100` for `'100'`).
|
| 30 |
+
- If you pass a string with a number and a valid unit, the number of
|
| 31 |
+
equivalent ms is returned.
|
| 32 |
+
|
| 33 |
+
## License
|
| 34 |
+
|
| 35 |
+
MIT
|
5485-master/demos/node_modules/express/node_modules/send/node_modules/ms/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "ms",
|
| 3 |
+
"version": "0.7.1",
|
| 4 |
+
"description": "Tiny ms conversion utility",
|
| 5 |
+
"repository": {
|
| 6 |
+
"type": "git",
|
| 7 |
+
"url": "git://github.com/guille/ms.js.git"
|
| 8 |
+
},
|
| 9 |
+
"main": "./index",
|
| 10 |
+
"devDependencies": {
|
| 11 |
+
"mocha": "*",
|
| 12 |
+
"expect.js": "*",
|
| 13 |
+
"serve": "*"
|
| 14 |
+
},
|
| 15 |
+
"component": {
|
| 16 |
+
"scripts": {
|
| 17 |
+
"ms/index.js": "index.js"
|
| 18 |
+
}
|
| 19 |
+
},
|
| 20 |
+
"gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909",
|
| 21 |
+
"bugs": {
|
| 22 |
+
"url": "https://github.com/guille/ms.js/issues"
|
| 23 |
+
},
|
| 24 |
+
"homepage": "https://github.com/guille/ms.js",
|
| 25 |
+
"_id": "ms@0.7.1",
|
| 26 |
+
"scripts": {},
|
| 27 |
+
"_shasum": "9cd13c03adbff25b65effde7ce864ee952017098",
|
| 28 |
+
"_from": "ms@0.7.1",
|
| 29 |
+
"_npmVersion": "2.7.5",
|
| 30 |
+
"_nodeVersion": "0.12.2",
|
| 31 |
+
"_npmUser": {
|
| 32 |
+
"name": "rauchg",
|
| 33 |
+
"email": "rauchg@gmail.com"
|
| 34 |
+
},
|
| 35 |
+
"maintainers": [
|
| 36 |
+
{
|
| 37 |
+
"name": "rauchg",
|
| 38 |
+
"email": "rauchg@gmail.com"
|
| 39 |
+
}
|
| 40 |
+
],
|
| 41 |
+
"dist": {
|
| 42 |
+
"shasum": "9cd13c03adbff25b65effde7ce864ee952017098",
|
| 43 |
+
"tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz"
|
| 44 |
+
},
|
| 45 |
+
"directories": {},
|
| 46 |
+
"_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz",
|
| 47 |
+
"readme": "ERROR: No README data found!"
|
| 48 |
+
}
|
5485-master/demos/node_modules/express/node_modules/serve-static/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# serve-static
|
| 2 |
+
|
| 3 |
+
[![NPM Version][npm-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][downloads-image]][downloads-url]
|
| 5 |
+
[![Linux Build][travis-image]][travis-url]
|
| 6 |
+
[![Windows Build][appveyor-image]][appveyor-url]
|
| 7 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
| 8 |
+
[![Gratipay][gratipay-image]][gratipay-url]
|
| 9 |
+
|
| 10 |
+
## Install
|
| 11 |
+
|
| 12 |
+
```sh
|
| 13 |
+
$ npm install serve-static
|
| 14 |
+
```
|
| 15 |
+
|
| 16 |
+
## API
|
| 17 |
+
|
| 18 |
+
```js
|
| 19 |
+
var serveStatic = require('serve-static')
|
| 20 |
+
```
|
| 21 |
+
|
| 22 |
+
### serveStatic(root, options)
|
| 23 |
+
|
| 24 |
+
Create a new middleware function to serve files from within a given root
|
| 25 |
+
directory. The file to serve will be determined by combining `req.url`
|
| 26 |
+
with the provided root directory. When a file is not found, instead of
|
| 27 |
+
sending a 404 response, this module will instead call `next()` to move on
|
| 28 |
+
to the next middleware, allowing for stacking and fall-backs.
|
| 29 |
+
|
| 30 |
+
#### Options
|
| 31 |
+
|
| 32 |
+
##### dotfiles
|
| 33 |
+
|
| 34 |
+
Set how "dotfiles" are treated when encountered. A dotfile is a file
|
| 35 |
+
or directory that begins with a dot ("."). Note this check is done on
|
| 36 |
+
the path itself without checking if the path actually exists on the
|
| 37 |
+
disk. If `root` is specified, only the dotfiles above the root are
|
| 38 |
+
checked (i.e. the root itself can be within a dotfile when set
|
| 39 |
+
to "deny").
|
| 40 |
+
|
| 41 |
+
The default value is `'ignore'`.
|
| 42 |
+
|
| 43 |
+
- `'allow'` No special treatment for dotfiles.
|
| 44 |
+
- `'deny'` Send a 403 for any request for a dotfile.
|
| 45 |
+
- `'ignore'` Pretend like the dotfile does not exist and call `next()`.
|
| 46 |
+
|
| 47 |
+
##### etag
|
| 48 |
+
|
| 49 |
+
Enable or disable etag generation, defaults to true.
|
| 50 |
+
|
| 51 |
+
##### extensions
|
| 52 |
+
|
| 53 |
+
Set file extension fallbacks. When set, if a file is not found, the given
|
| 54 |
+
extensions will be added to the file name and search for. The first that
|
| 55 |
+
exists will be served. Example: `['html', 'htm']`.
|
| 56 |
+
|
| 57 |
+
The default value is `false`.
|
| 58 |
+
|
| 59 |
+
##### index
|
| 60 |
+
|
| 61 |
+
By default this module will send "index.html" files in response to a request
|
| 62 |
+
on a directory. To disable this set `false` or to supply a new index pass a
|
| 63 |
+
string or an array in preferred order.
|
| 64 |
+
|
| 65 |
+
##### lastModified
|
| 66 |
+
|
| 67 |
+
Enable or disable `Last-Modified` header, defaults to true. Uses the file
|
| 68 |
+
system's last modified value.
|
| 69 |
+
|
| 70 |
+
##### maxAge
|
| 71 |
+
|
| 72 |
+
Provide a max-age in milliseconds for http caching, defaults to 0. This
|
| 73 |
+
can also be a string accepted by the [ms](https://www.npmjs.org/package/ms#readme)
|
| 74 |
+
module.
|
| 75 |
+
|
| 76 |
+
##### redirect
|
| 77 |
+
|
| 78 |
+
Redirect to trailing "/" when the pathname is a dir. Defaults to `true`.
|
| 79 |
+
|
| 80 |
+
##### setHeaders
|
| 81 |
+
|
| 82 |
+
Function to set custom headers on response. Alterations to the headers need to
|
| 83 |
+
occur synchronously. The function is called as `fn(res, path, stat)`, where
|
| 84 |
+
the arguments are:
|
| 85 |
+
|
| 86 |
+
- `res` the response object
|
| 87 |
+
- `path` the file path that is being sent
|
| 88 |
+
- `stat` the stat object of the file that is being sent
|
| 89 |
+
|
| 90 |
+
## Examples
|
| 91 |
+
|
| 92 |
+
### Serve files with vanilla node.js http server
|
| 93 |
+
|
| 94 |
+
```js
|
| 95 |
+
var finalhandler = require('finalhandler')
|
| 96 |
+
var http = require('http')
|
| 97 |
+
var serveStatic = require('serve-static')
|
| 98 |
+
|
| 99 |
+
// Serve up public/ftp folder
|
| 100 |
+
var serve = serveStatic('public/ftp', {'index': ['index.html', 'index.htm']})
|
| 101 |
+
|
| 102 |
+
// Create server
|
| 103 |
+
var server = http.createServer(function(req, res){
|
| 104 |
+
var done = finalhandler(req, res)
|
| 105 |
+
serve(req, res, done)
|
| 106 |
+
})
|
| 107 |
+
|
| 108 |
+
// Listen
|
| 109 |
+
server.listen(3000)
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
### Serve all files as downloads
|
| 113 |
+
|
| 114 |
+
```js
|
| 115 |
+
var contentDisposition = require('content-disposition')
|
| 116 |
+
var finalhandler = require('finalhandler')
|
| 117 |
+
var http = require('http')
|
| 118 |
+
var serveStatic = require('serve-static')
|
| 119 |
+
|
| 120 |
+
// Serve up public/ftp folder
|
| 121 |
+
var serve = serveStatic('public/ftp', {
|
| 122 |
+
'index': false,
|
| 123 |
+
'setHeaders': setHeaders
|
| 124 |
+
})
|
| 125 |
+
|
| 126 |
+
// Set header to force download
|
| 127 |
+
function setHeaders(res, path) {
|
| 128 |
+
res.setHeader('Content-Disposition', contentDisposition(path))
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
// Create server
|
| 132 |
+
var server = http.createServer(function(req, res){
|
| 133 |
+
var done = finalhandler(req, res)
|
| 134 |
+
serve(req, res, done)
|
| 135 |
+
})
|
| 136 |
+
|
| 137 |
+
// Listen
|
| 138 |
+
server.listen(3000)
|
| 139 |
+
```
|
| 140 |
+
|
| 141 |
+
### Serving using express
|
| 142 |
+
|
| 143 |
+
#### Simple
|
| 144 |
+
|
| 145 |
+
This is a simple example of using Express.
|
| 146 |
+
|
| 147 |
+
```js
|
| 148 |
+
var express = require('express')
|
| 149 |
+
var serveStatic = require('serve-static')
|
| 150 |
+
|
| 151 |
+
var app = express()
|
| 152 |
+
|
| 153 |
+
app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']}))
|
| 154 |
+
app.listen(3000)
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
#### Multiple roots
|
| 158 |
+
|
| 159 |
+
This example shows a simple way to search through multiple directories.
|
| 160 |
+
Files are look for in `public-optimized/` first, then `public/` second as
|
| 161 |
+
a fallback.
|
| 162 |
+
|
| 163 |
+
```js
|
| 164 |
+
var express = require('express')
|
| 165 |
+
var serveStatic = require('serve-static')
|
| 166 |
+
|
| 167 |
+
var app = express()
|
| 168 |
+
|
| 169 |
+
app.use(serveStatic(__dirname + '/public-optimized'))
|
| 170 |
+
app.use(serveStatic(__dirname + '/public'))
|
| 171 |
+
app.listen(3000)
|
| 172 |
+
```
|
| 173 |
+
|
| 174 |
+
#### Different settings for paths
|
| 175 |
+
|
| 176 |
+
This example shows how to set a different max age depending on the served
|
| 177 |
+
file type. In this example, HTML files are not cached, while everything else
|
| 178 |
+
is for 1 day.
|
| 179 |
+
|
| 180 |
+
```js
|
| 181 |
+
var express = require('express')
|
| 182 |
+
var serveStatic = require('serve-static')
|
| 183 |
+
|
| 184 |
+
var app = express()
|
| 185 |
+
|
| 186 |
+
app.use(serveStatic(__dirname + '/public', {
|
| 187 |
+
maxAge: '1d',
|
| 188 |
+
setHeaders: setCustomCacheControl
|
| 189 |
+
}))
|
| 190 |
+
|
| 191 |
+
app.listen(3000)
|
| 192 |
+
|
| 193 |
+
function setCustomCacheControl(res, path) {
|
| 194 |
+
if (serveStatic.mime.lookup(path) === 'text/html') {
|
| 195 |
+
// Custom Cache-Control for HTML files
|
| 196 |
+
res.setHeader('Cache-Control', 'public, max-age=0')
|
| 197 |
+
}
|
| 198 |
+
}
|
| 199 |
+
```
|
| 200 |
+
|
| 201 |
+
## License
|
| 202 |
+
|
| 203 |
+
[MIT](LICENSE)
|
| 204 |
+
|
| 205 |
+
[npm-image]: https://img.shields.io/npm/v/serve-static.svg
|
| 206 |
+
[npm-url]: https://npmjs.org/package/serve-static
|
| 207 |
+
[travis-image]: https://img.shields.io/travis/expressjs/serve-static/master.svg?label=linux
|
| 208 |
+
[travis-url]: https://travis-ci.org/expressjs/serve-static
|
| 209 |
+
[appveyor-image]: https://img.shields.io/appveyor/ci/dougwilson/serve-static/master.svg?label=windows
|
| 210 |
+
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/serve-static
|
| 211 |
+
[coveralls-image]: https://img.shields.io/coveralls/expressjs/serve-static/master.svg
|
| 212 |
+
[coveralls-url]: https://coveralls.io/r/expressjs/serve-static
|
| 213 |
+
[downloads-image]: https://img.shields.io/npm/dm/serve-static.svg
|
| 214 |
+
[downloads-url]: https://npmjs.org/package/serve-static
|
| 215 |
+
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
|
| 216 |
+
[gratipay-url]: https://gratipay.com/dougwilson/
|
5485-master/demos/node_modules/express/node_modules/serve-static/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* serve-static
|
| 3 |
+
* Copyright(c) 2010 Sencha Inc.
|
| 4 |
+
* Copyright(c) 2011 TJ Holowaychuk
|
| 5 |
+
* Copyright(c) 2014 Douglas Christopher Wilson
|
| 6 |
+
* MIT Licensed
|
| 7 |
+
*/
|
| 8 |
+
|
| 9 |
+
/**
|
| 10 |
+
* Module dependencies.
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
var escapeHtml = require('escape-html');
|
| 14 |
+
var merge = require('utils-merge');
|
| 15 |
+
var parseurl = require('parseurl');
|
| 16 |
+
var resolve = require('path').resolve;
|
| 17 |
+
var send = require('send');
|
| 18 |
+
var url = require('url');
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* @param {String} root
|
| 22 |
+
* @param {Object} options
|
| 23 |
+
* @return {Function}
|
| 24 |
+
* @api public
|
| 25 |
+
*/
|
| 26 |
+
|
| 27 |
+
exports = module.exports = function serveStatic(root, options) {
|
| 28 |
+
if (!root) {
|
| 29 |
+
throw new TypeError('root path required')
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
if (typeof root !== 'string') {
|
| 33 |
+
throw new TypeError('root path must be a string')
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
// copy options object
|
| 37 |
+
options = merge({}, options)
|
| 38 |
+
|
| 39 |
+
// resolve root to absolute
|
| 40 |
+
root = resolve(root)
|
| 41 |
+
|
| 42 |
+
// default redirect
|
| 43 |
+
var redirect = options.redirect !== false
|
| 44 |
+
|
| 45 |
+
// headers listener
|
| 46 |
+
var setHeaders = options.setHeaders
|
| 47 |
+
delete options.setHeaders
|
| 48 |
+
|
| 49 |
+
if (setHeaders && typeof setHeaders !== 'function') {
|
| 50 |
+
throw new TypeError('option setHeaders must be function')
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
// setup options for send
|
| 54 |
+
options.maxage = options.maxage || options.maxAge || 0
|
| 55 |
+
options.root = root
|
| 56 |
+
|
| 57 |
+
return function serveStatic(req, res, next) {
|
| 58 |
+
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
| 59 |
+
return next()
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
var opts = merge({}, options)
|
| 63 |
+
var originalUrl = parseurl.original(req)
|
| 64 |
+
var path = parseurl(req).pathname
|
| 65 |
+
var hasTrailingSlash = originalUrl.pathname[originalUrl.pathname.length - 1] === '/'
|
| 66 |
+
|
| 67 |
+
if (path === '/' && !hasTrailingSlash) {
|
| 68 |
+
// make sure redirect occurs at mount
|
| 69 |
+
path = ''
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
// create send stream
|
| 73 |
+
var stream = send(req, path, opts)
|
| 74 |
+
|
| 75 |
+
if (redirect) {
|
| 76 |
+
// redirect relative to originalUrl
|
| 77 |
+
stream.on('directory', function redirect() {
|
| 78 |
+
if (hasTrailingSlash) {
|
| 79 |
+
return next()
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
// append trailing slash
|
| 83 |
+
originalUrl.path = null
|
| 84 |
+
originalUrl.pathname = collapseLeadingSlashes(originalUrl.pathname + '/')
|
| 85 |
+
|
| 86 |
+
// reformat the URL
|
| 87 |
+
var target = url.format(originalUrl)
|
| 88 |
+
|
| 89 |
+
// send redirect response
|
| 90 |
+
res.statusCode = 303
|
| 91 |
+
res.setHeader('Content-Type', 'text/html; charset=utf-8')
|
| 92 |
+
res.setHeader('Location', target)
|
| 93 |
+
res.end('Redirecting to <a href="' + escapeHtml(target) + '">' + escapeHtml(target) + '</a>\n')
|
| 94 |
+
})
|
| 95 |
+
} else {
|
| 96 |
+
// forward to next middleware on directory
|
| 97 |
+
stream.on('directory', next)
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// add headers listener
|
| 101 |
+
if (setHeaders) {
|
| 102 |
+
stream.on('headers', setHeaders)
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
// forward non-404 errors
|
| 106 |
+
stream.on('error', function error(err) {
|
| 107 |
+
next(err.status === 404 ? null : err)
|
| 108 |
+
})
|
| 109 |
+
|
| 110 |
+
// pipe
|
| 111 |
+
stream.pipe(res)
|
| 112 |
+
}
|
| 113 |
+
}
|
| 114 |
+
|
| 115 |
+
/**
|
| 116 |
+
* Expose mime module.
|
| 117 |
+
*
|
| 118 |
+
* If you wish to extend the mime table use this
|
| 119 |
+
* reference to the "mime" module in the npm registry.
|
| 120 |
+
*/
|
| 121 |
+
|
| 122 |
+
exports.mime = send.mime
|
| 123 |
+
|
| 124 |
+
/**
|
| 125 |
+
* Collapse all leading slashes into a single slash
|
| 126 |
+
* @private
|
| 127 |
+
*/
|
| 128 |
+
function collapseLeadingSlashes(str) {
|
| 129 |
+
for (var i = 0; i < str.length; i++) {
|
| 130 |
+
if (str[i] !== '/') {
|
| 131 |
+
break
|
| 132 |
+
}
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
return i > 1
|
| 136 |
+
? '/' + str.substr(i)
|
| 137 |
+
: str
|
| 138 |
+
}
|
5485-master/demos/node_modules/express/node_modules/serve-static/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "serve-static",
|
| 3 |
+
"description": "Serve static files",
|
| 4 |
+
"version": "1.9.3",
|
| 5 |
+
"author": {
|
| 6 |
+
"name": "Douglas Christopher Wilson",
|
| 7 |
+
"email": "doug@somethingdoug.com"
|
| 8 |
+
},
|
| 9 |
+
"license": "MIT",
|
| 10 |
+
"repository": {
|
| 11 |
+
"type": "git",
|
| 12 |
+
"url": "git+https://github.com/expressjs/serve-static.git"
|
| 13 |
+
},
|
| 14 |
+
"dependencies": {
|
| 15 |
+
"escape-html": "1.0.1",
|
| 16 |
+
"parseurl": "~1.3.0",
|
| 17 |
+
"send": "0.12.3",
|
| 18 |
+
"utils-merge": "1.0.0"
|
| 19 |
+
},
|
| 20 |
+
"devDependencies": {
|
| 21 |
+
"istanbul": "0.3.9",
|
| 22 |
+
"mocha": "2.2.5",
|
| 23 |
+
"supertest": "1.0.1"
|
| 24 |
+
},
|
| 25 |
+
"files": [
|
| 26 |
+
"LICENSE",
|
| 27 |
+
"HISTORY.md",
|
| 28 |
+
"index.js"
|
| 29 |
+
],
|
| 30 |
+
"engines": {
|
| 31 |
+
"node": ">= 0.8.0"
|
| 32 |
+
},
|
| 33 |
+
"scripts": {
|
| 34 |
+
"test": "mocha --reporter spec --bail --check-leaks test/",
|
| 35 |
+
"test-ci": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
| 36 |
+
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/"
|
| 37 |
+
},
|
| 38 |
+
"gitHead": "c76d20a9f51a15a467eab2b0610e5de60506dfbc",
|
| 39 |
+
"bugs": {
|
| 40 |
+
"url": "https://github.com/expressjs/serve-static/issues"
|
| 41 |
+
},
|
| 42 |
+
"homepage": "https://github.com/expressjs/serve-static",
|
| 43 |
+
"_id": "serve-static@1.9.3",
|
| 44 |
+
"_shasum": "5f8da07323ad385ff3dc541f1a7917b2e436eb57",
|
| 45 |
+
"_from": "serve-static@>=1.9.3 <1.10.0",
|
| 46 |
+
"_npmVersion": "1.4.28",
|
| 47 |
+
"_npmUser": {
|
| 48 |
+
"name": "dougwilson",
|
| 49 |
+
"email": "doug@somethingdoug.com"
|
| 50 |
+
},
|
| 51 |
+
"maintainers": [
|
| 52 |
+
{
|
| 53 |
+
"name": "dougwilson",
|
| 54 |
+
"email": "doug@somethingdoug.com"
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"name": "jongleberry",
|
| 58 |
+
"email": "jonathanrichardong@gmail.com"
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"name": "tjholowaychuk",
|
| 62 |
+
"email": "tj@vision-media.ca"
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"name": "mscdex",
|
| 66 |
+
"email": "mscdex@mscdex.net"
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"name": "fishrock123",
|
| 70 |
+
"email": "fishrock123@rocketmail.com"
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"name": "defunctzombie",
|
| 74 |
+
"email": "shtylman@gmail.com"
|
| 75 |
+
}
|
| 76 |
+
],
|
| 77 |
+
"dist": {
|
| 78 |
+
"shasum": "5f8da07323ad385ff3dc541f1a7917b2e436eb57",
|
| 79 |
+
"tarball": "http://registry.npmjs.org/serve-static/-/serve-static-1.9.3.tgz"
|
| 80 |
+
},
|
| 81 |
+
"directories": {},
|
| 82 |
+
"_resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.9.3.tgz",
|
| 83 |
+
"readme": "ERROR: No README data found!"
|
| 84 |
+
}
|
5485-master/demos/node_modules/express/node_modules/type-is/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 21 |
+
THE SOFTWARE.
|
5485-master/demos/node_modules/express/node_modules/type-is/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# type-is
|
| 2 |
+
|
| 3 |
+
[![NPM Version][npm-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][downloads-image]][downloads-url]
|
| 5 |
+
[![Node.js Version][node-version-image]][node-version-url]
|
| 6 |
+
[![Build Status][travis-image]][travis-url]
|
| 7 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
| 8 |
+
|
| 9 |
+
Infer the content-type of a request.
|
| 10 |
+
|
| 11 |
+
### Install
|
| 12 |
+
|
| 13 |
+
```sh
|
| 14 |
+
$ npm install type-is
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## API
|
| 18 |
+
|
| 19 |
+
```js
|
| 20 |
+
var http = require('http')
|
| 21 |
+
var is = require('type-is')
|
| 22 |
+
|
| 23 |
+
http.createServer(function (req, res) {
|
| 24 |
+
var istext = is(req, ['text/*'])
|
| 25 |
+
res.end('you ' + (istext ? 'sent' : 'did not send') + ' me text')
|
| 26 |
+
})
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
### type = is(request, types)
|
| 30 |
+
|
| 31 |
+
`request` is the node HTTP request. `types` is an array of types.
|
| 32 |
+
|
| 33 |
+
```js
|
| 34 |
+
// req.headers.content-type = 'application/json'
|
| 35 |
+
|
| 36 |
+
is(req, ['json']) // 'json'
|
| 37 |
+
is(req, ['html', 'json']) // 'json'
|
| 38 |
+
is(req, ['application/*']) // 'application/json'
|
| 39 |
+
is(req, ['application/json']) // 'application/json'
|
| 40 |
+
|
| 41 |
+
is(req, ['html']) // false
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
### type = is.is(mediaType, types)
|
| 45 |
+
|
| 46 |
+
`mediaType` is the [media type](https://tools.ietf.org/html/rfc6838) string. `types` is an array of types.
|
| 47 |
+
|
| 48 |
+
```js
|
| 49 |
+
var mediaType = 'application/json'
|
| 50 |
+
|
| 51 |
+
is.is(mediaType, ['json']) // 'json'
|
| 52 |
+
is.is(mediaType, ['html', 'json']) // 'json'
|
| 53 |
+
is.is(mediaType, ['application/*']) // 'application/json'
|
| 54 |
+
is.is(mediaType, ['application/json']) // 'application/json'
|
| 55 |
+
|
| 56 |
+
is.is(mediaType, ['html']) // false
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
### Each type can be:
|
| 60 |
+
|
| 61 |
+
- An extension name such as `json`. This name will be returned if matched.
|
| 62 |
+
- A mime type such as `application/json`.
|
| 63 |
+
- A mime type with a wildcard such as `*/*` or `*/json` or `application/*`. The full mime type will be returned if matched.
|
| 64 |
+
- A suffix such as `+json`. This can be combined with a wildcard such as `*/vnd+json` or `application/*+json`. The full mime type will be returned if matched.
|
| 65 |
+
|
| 66 |
+
`false` will be returned if no type matches.
|
| 67 |
+
|
| 68 |
+
`null` will be returned if the request does not have a body.
|
| 69 |
+
|
| 70 |
+
## Examples
|
| 71 |
+
|
| 72 |
+
#### Example body parser
|
| 73 |
+
|
| 74 |
+
```js
|
| 75 |
+
var is = require('type-is');
|
| 76 |
+
|
| 77 |
+
function bodyParser(req, res, next) {
|
| 78 |
+
if (!is.hasBody(req)) {
|
| 79 |
+
return next()
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
switch (is(req, ['urlencoded', 'json', 'multipart'])) {
|
| 83 |
+
case 'urlencoded':
|
| 84 |
+
// parse urlencoded body
|
| 85 |
+
throw new Error('implement urlencoded body parsing')
|
| 86 |
+
break
|
| 87 |
+
case 'json':
|
| 88 |
+
// parse json body
|
| 89 |
+
throw new Error('implement json body parsing')
|
| 90 |
+
break
|
| 91 |
+
case 'multipart':
|
| 92 |
+
// parse multipart body
|
| 93 |
+
throw new Error('implement multipart body parsing')
|
| 94 |
+
break
|
| 95 |
+
default:
|
| 96 |
+
// 415 error code
|
| 97 |
+
res.statusCode = 415
|
| 98 |
+
res.end()
|
| 99 |
+
return
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## License
|
| 105 |
+
|
| 106 |
+
[MIT](LICENSE)
|
| 107 |
+
|
| 108 |
+
[npm-image]: https://img.shields.io/npm/v/type-is.svg?style=flat
|
| 109 |
+
[npm-url]: https://npmjs.org/package/type-is
|
| 110 |
+
[node-version-image]: https://img.shields.io/node/v/type-is.svg?style=flat
|
| 111 |
+
[node-version-url]: http://nodejs.org/download/
|
| 112 |
+
[travis-image]: https://img.shields.io/travis/jshttp/type-is.svg?style=flat
|
| 113 |
+
[travis-url]: https://travis-ci.org/jshttp/type-is
|
| 114 |
+
[coveralls-image]: https://img.shields.io/coveralls/jshttp/type-is.svg?style=flat
|
| 115 |
+
[coveralls-url]: https://coveralls.io/r/jshttp/type-is?branch=master
|
| 116 |
+
[downloads-image]: https://img.shields.io/npm/dm/type-is.svg?style=flat
|
| 117 |
+
[downloads-url]: https://npmjs.org/package/type-is
|
5485-master/demos/node_modules/express/node_modules/type-is/index.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
var typer = require('media-typer')
|
| 3 |
+
var mime = require('mime-types')
|
| 4 |
+
|
| 5 |
+
module.exports = typeofrequest;
|
| 6 |
+
typeofrequest.is = typeis;
|
| 7 |
+
typeofrequest.hasBody = hasbody;
|
| 8 |
+
typeofrequest.normalize = normalize;
|
| 9 |
+
typeofrequest.match = mimeMatch;
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Compare a `value` content-type with `types`.
|
| 13 |
+
* Each `type` can be an extension like `html`,
|
| 14 |
+
* a special shortcut like `multipart` or `urlencoded`,
|
| 15 |
+
* or a mime type.
|
| 16 |
+
*
|
| 17 |
+
* If no types match, `false` is returned.
|
| 18 |
+
* Otherwise, the first `type` that matches is returned.
|
| 19 |
+
*
|
| 20 |
+
* @param {String} value
|
| 21 |
+
* @param {Array} types
|
| 22 |
+
* @return String
|
| 23 |
+
*/
|
| 24 |
+
|
| 25 |
+
function typeis(value, types_) {
|
| 26 |
+
var i
|
| 27 |
+
var types = types_
|
| 28 |
+
|
| 29 |
+
// remove parameters and normalize
|
| 30 |
+
var val = typenormalize(value)
|
| 31 |
+
|
| 32 |
+
// no type or invalid
|
| 33 |
+
if (!val) {
|
| 34 |
+
return false
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// support flattened arguments
|
| 38 |
+
if (types && !Array.isArray(types)) {
|
| 39 |
+
types = new Array(arguments.length - 1)
|
| 40 |
+
for (i = 0; i < types.length; i++) {
|
| 41 |
+
types[i] = arguments[i + 1]
|
| 42 |
+
}
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
// no types, return the content type
|
| 46 |
+
if (!types || !types.length) {
|
| 47 |
+
return val
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
var type
|
| 51 |
+
for (i = 0; i < types.length; i++) {
|
| 52 |
+
if (mimeMatch(normalize(type = types[i]), val)) {
|
| 53 |
+
return type[0] === '+' || ~type.indexOf('*')
|
| 54 |
+
? val
|
| 55 |
+
: type
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
// no matches
|
| 60 |
+
return false;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/**
|
| 64 |
+
* Check if a request has a request body.
|
| 65 |
+
* A request with a body __must__ either have `transfer-encoding`
|
| 66 |
+
* or `content-length` headers set.
|
| 67 |
+
* http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.3
|
| 68 |
+
*
|
| 69 |
+
* @param {Object} request
|
| 70 |
+
* @return {Boolean}
|
| 71 |
+
* @api public
|
| 72 |
+
*/
|
| 73 |
+
|
| 74 |
+
function hasbody(req) {
|
| 75 |
+
return req.headers['transfer-encoding'] !== undefined
|
| 76 |
+
|| !isNaN(req.headers['content-length'])
|
| 77 |
+
}
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Check if the incoming request contains the "Content-Type"
|
| 81 |
+
* header field, and it contains any of the give mime `type`s.
|
| 82 |
+
* If there is no request body, `null` is returned.
|
| 83 |
+
* If there is no content type, `false` is returned.
|
| 84 |
+
* Otherwise, it returns the first `type` that matches.
|
| 85 |
+
*
|
| 86 |
+
* Examples:
|
| 87 |
+
*
|
| 88 |
+
* // With Content-Type: text/html; charset=utf-8
|
| 89 |
+
* this.is('html'); // => 'html'
|
| 90 |
+
* this.is('text/html'); // => 'text/html'
|
| 91 |
+
* this.is('text/*', 'application/json'); // => 'text/html'
|
| 92 |
+
*
|
| 93 |
+
* // When Content-Type is application/json
|
| 94 |
+
* this.is('json', 'urlencoded'); // => 'json'
|
| 95 |
+
* this.is('application/json'); // => 'application/json'
|
| 96 |
+
* this.is('html', 'application/*'); // => 'application/json'
|
| 97 |
+
*
|
| 98 |
+
* this.is('html'); // => false
|
| 99 |
+
*
|
| 100 |
+
* @param {String|Array} types...
|
| 101 |
+
* @return {String|false|null}
|
| 102 |
+
* @api public
|
| 103 |
+
*/
|
| 104 |
+
|
| 105 |
+
function typeofrequest(req, types_) {
|
| 106 |
+
var types = types_
|
| 107 |
+
|
| 108 |
+
// no body
|
| 109 |
+
if (!hasbody(req)) {
|
| 110 |
+
return null
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
// support flattened arguments
|
| 114 |
+
if (arguments.length > 2) {
|
| 115 |
+
types = new Array(arguments.length - 1)
|
| 116 |
+
for (var i = 0; i < types.length; i++) {
|
| 117 |
+
types[i] = arguments[i + 1]
|
| 118 |
+
}
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
// request content type
|
| 122 |
+
var value = req.headers['content-type']
|
| 123 |
+
|
| 124 |
+
return typeis(value, types);
|
| 125 |
+
}
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* Normalize a mime type.
|
| 129 |
+
* If it's a shorthand, expand it to a valid mime type.
|
| 130 |
+
*
|
| 131 |
+
* In general, you probably want:
|
| 132 |
+
*
|
| 133 |
+
* var type = is(req, ['urlencoded', 'json', 'multipart']);
|
| 134 |
+
*
|
| 135 |
+
* Then use the appropriate body parsers.
|
| 136 |
+
* These three are the most common request body types
|
| 137 |
+
* and are thus ensured to work.
|
| 138 |
+
*
|
| 139 |
+
* @param {String} type
|
| 140 |
+
* @api private
|
| 141 |
+
*/
|
| 142 |
+
|
| 143 |
+
function normalize(type) {
|
| 144 |
+
switch (type) {
|
| 145 |
+
case 'urlencoded':
|
| 146 |
+
type = 'application/x-www-form-urlencoded'
|
| 147 |
+
break
|
| 148 |
+
case 'multipart':
|
| 149 |
+
type = 'multipart/*'
|
| 150 |
+
break
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
if (type[0] === '+') {
|
| 154 |
+
// "+json" -> "*/*+json" expando
|
| 155 |
+
type = '*/*' + type
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
return type.indexOf('/') === -1
|
| 159 |
+
? mime.lookup(type)
|
| 160 |
+
: type
|
| 161 |
+
}
|
| 162 |
+
|
| 163 |
+
/**
|
| 164 |
+
* Check if `exected` mime type
|
| 165 |
+
* matches `actual` mime type with
|
| 166 |
+
* wildcard and +suffix support.
|
| 167 |
+
*
|
| 168 |
+
* @param {String} expected
|
| 169 |
+
* @param {String} actual
|
| 170 |
+
* @return {Boolean}
|
| 171 |
+
* @api private
|
| 172 |
+
*/
|
| 173 |
+
|
| 174 |
+
function mimeMatch(expected, actual) {
|
| 175 |
+
// invalid type
|
| 176 |
+
if (expected === false) {
|
| 177 |
+
return false
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
// split types
|
| 181 |
+
var actualParts = actual.split('/')
|
| 182 |
+
var expectedParts = expected.split('/')
|
| 183 |
+
|
| 184 |
+
// invalid format
|
| 185 |
+
if (actualParts.length !== 2 || expectedParts.length !== 2) {
|
| 186 |
+
return false
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
// validate type
|
| 190 |
+
if (expectedParts[0] !== '*' && expectedParts[0] !== actualParts[0]) {
|
| 191 |
+
return false
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
// validate suffix wildcard
|
| 195 |
+
if (expectedParts[1].substr(0, 2) === '*+') {
|
| 196 |
+
return expectedParts[1].length <= actualParts[1].length + 1
|
| 197 |
+
&& expectedParts[1].substr(1) === actualParts[1].substr(1 - expectedParts[1].length)
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
// validate subtype
|
| 201 |
+
if (expectedParts[1] !== '*' && expectedParts[1] !== actualParts[1]) {
|
| 202 |
+
return false
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
return true
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
/**
|
| 209 |
+
* Normalize a type and remove parameters.
|
| 210 |
+
*
|
| 211 |
+
* @param {string} value
|
| 212 |
+
* @return {string}
|
| 213 |
+
* @api private
|
| 214 |
+
*/
|
| 215 |
+
|
| 216 |
+
function typenormalize(value) {
|
| 217 |
+
try {
|
| 218 |
+
var type = typer.parse(value)
|
| 219 |
+
delete type.parameters
|
| 220 |
+
return typer.format(type)
|
| 221 |
+
} catch (err) {
|
| 222 |
+
return null
|
| 223 |
+
}
|
| 224 |
+
}
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/HISTORY.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
0.3.0 / 2014-09-07
|
| 2 |
+
==================
|
| 3 |
+
|
| 4 |
+
* Support Node.js 0.6
|
| 5 |
+
* Throw error when parameter format invalid on parse
|
| 6 |
+
|
| 7 |
+
0.2.0 / 2014-06-18
|
| 8 |
+
==================
|
| 9 |
+
|
| 10 |
+
* Add `typer.format()` to format media types
|
| 11 |
+
|
| 12 |
+
0.1.0 / 2014-06-17
|
| 13 |
+
==================
|
| 14 |
+
|
| 15 |
+
* Accept `req` as argument to `parse`
|
| 16 |
+
* Accept `res` as argument to `parse`
|
| 17 |
+
* Parse media type with extra LWS between type and first parameter
|
| 18 |
+
|
| 19 |
+
0.0.0 / 2014-06-13
|
| 20 |
+
==================
|
| 21 |
+
|
| 22 |
+
* Initial implementation
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014 Douglas Christopher Wilson
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# media-typer
|
| 2 |
+
|
| 3 |
+
[![NPM Version][npm-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][downloads-image]][downloads-url]
|
| 5 |
+
[![Node.js Version][node-version-image]][node-version-url]
|
| 6 |
+
[![Build Status][travis-image]][travis-url]
|
| 7 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
| 8 |
+
|
| 9 |
+
Simple RFC 6838 media type parser
|
| 10 |
+
|
| 11 |
+
## Installation
|
| 12 |
+
|
| 13 |
+
```sh
|
| 14 |
+
$ npm install media-typer
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## API
|
| 18 |
+
|
| 19 |
+
```js
|
| 20 |
+
var typer = require('media-typer')
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
### typer.parse(string)
|
| 24 |
+
|
| 25 |
+
```js
|
| 26 |
+
var obj = typer.parse('image/svg+xml; charset=utf-8')
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
Parse a media type string. This will return an object with the following
|
| 30 |
+
properties (examples are shown for the string `'image/svg+xml; charset=utf-8'`):
|
| 31 |
+
|
| 32 |
+
- `type`: The type of the media type (always lower case). Example: `'image'`
|
| 33 |
+
|
| 34 |
+
- `subtype`: The subtype of the media type (always lower case). Example: `'svg'`
|
| 35 |
+
|
| 36 |
+
- `suffix`: The suffix of the media type (always lower case). Example: `'xml'`
|
| 37 |
+
|
| 38 |
+
- `parameters`: An object of the parameters in the media type (name of parameter always lower case). Example: `{charset: 'utf-8'}`
|
| 39 |
+
|
| 40 |
+
### typer.parse(req)
|
| 41 |
+
|
| 42 |
+
```js
|
| 43 |
+
var obj = typer.parse(req)
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
Parse the `content-type` header from the given `req`. Short-cut for
|
| 47 |
+
`typer.parse(req.headers['content-type'])`.
|
| 48 |
+
|
| 49 |
+
### typer.parse(res)
|
| 50 |
+
|
| 51 |
+
```js
|
| 52 |
+
var obj = typer.parse(res)
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
Parse the `content-type` header set on the given `res`. Short-cut for
|
| 56 |
+
`typer.parse(res.getHeader('content-type'))`.
|
| 57 |
+
|
| 58 |
+
### typer.format(obj)
|
| 59 |
+
|
| 60 |
+
```js
|
| 61 |
+
var obj = typer.format({type: 'image', subtype: 'svg', suffix: 'xml'})
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
Format an object into a media type string. This will return a string of the
|
| 65 |
+
mime type for the given object. For the properties of the object, see the
|
| 66 |
+
documentation for `typer.parse(string)`.
|
| 67 |
+
|
| 68 |
+
## License
|
| 69 |
+
|
| 70 |
+
[MIT](LICENSE)
|
| 71 |
+
|
| 72 |
+
[npm-image]: https://img.shields.io/npm/v/media-typer.svg?style=flat
|
| 73 |
+
[npm-url]: https://npmjs.org/package/media-typer
|
| 74 |
+
[node-version-image]: https://img.shields.io/badge/node.js-%3E%3D_0.6-brightgreen.svg?style=flat
|
| 75 |
+
[node-version-url]: http://nodejs.org/download/
|
| 76 |
+
[travis-image]: https://img.shields.io/travis/jshttp/media-typer.svg?style=flat
|
| 77 |
+
[travis-url]: https://travis-ci.org/jshttp/media-typer
|
| 78 |
+
[coveralls-image]: https://img.shields.io/coveralls/jshttp/media-typer.svg?style=flat
|
| 79 |
+
[coveralls-url]: https://coveralls.io/r/jshttp/media-typer
|
| 80 |
+
[downloads-image]: https://img.shields.io/npm/dm/media-typer.svg?style=flat
|
| 81 |
+
[downloads-url]: https://npmjs.org/package/media-typer
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/index.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* media-typer
|
| 3 |
+
* Copyright(c) 2014 Douglas Christopher Wilson
|
| 4 |
+
* MIT Licensed
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* RegExp to match *( ";" parameter ) in RFC 2616 sec 3.7
|
| 9 |
+
*
|
| 10 |
+
* parameter = token "=" ( token | quoted-string )
|
| 11 |
+
* token = 1*<any CHAR except CTLs or separators>
|
| 12 |
+
* separators = "(" | ")" | "<" | ">" | "@"
|
| 13 |
+
* | "," | ";" | ":" | "\" | <">
|
| 14 |
+
* | "/" | "[" | "]" | "?" | "="
|
| 15 |
+
* | "{" | "}" | SP | HT
|
| 16 |
+
* quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
|
| 17 |
+
* qdtext = <any TEXT except <">>
|
| 18 |
+
* quoted-pair = "\" CHAR
|
| 19 |
+
* CHAR = <any US-ASCII character (octets 0 - 127)>
|
| 20 |
+
* TEXT = <any OCTET except CTLs, but including LWS>
|
| 21 |
+
* LWS = [CRLF] 1*( SP | HT )
|
| 22 |
+
* CRLF = CR LF
|
| 23 |
+
* CR = <US-ASCII CR, carriage return (13)>
|
| 24 |
+
* LF = <US-ASCII LF, linefeed (10)>
|
| 25 |
+
* SP = <US-ASCII SP, space (32)>
|
| 26 |
+
* SHT = <US-ASCII HT, horizontal-tab (9)>
|
| 27 |
+
* CTL = <any US-ASCII control character (octets 0 - 31) and DEL (127)>
|
| 28 |
+
* OCTET = <any 8-bit sequence of data>
|
| 29 |
+
*/
|
| 30 |
+
var paramRegExp = /; *([!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) *= *("(?:[ !\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u0020-\u007e])*"|[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+) */g;
|
| 31 |
+
var textRegExp = /^[\u0020-\u007e\u0080-\u00ff]+$/
|
| 32 |
+
var tokenRegExp = /^[!#$%&'\*\+\-\.0-9A-Z\^_`a-z\|~]+$/
|
| 33 |
+
|
| 34 |
+
/**
|
| 35 |
+
* RegExp to match quoted-pair in RFC 2616
|
| 36 |
+
*
|
| 37 |
+
* quoted-pair = "\" CHAR
|
| 38 |
+
* CHAR = <any US-ASCII character (octets 0 - 127)>
|
| 39 |
+
*/
|
| 40 |
+
var qescRegExp = /\\([\u0000-\u007f])/g;
|
| 41 |
+
|
| 42 |
+
/**
|
| 43 |
+
* RegExp to match chars that must be quoted-pair in RFC 2616
|
| 44 |
+
*/
|
| 45 |
+
var quoteRegExp = /([\\"])/g;
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* RegExp to match type in RFC 6838
|
| 49 |
+
*
|
| 50 |
+
* type-name = restricted-name
|
| 51 |
+
* subtype-name = restricted-name
|
| 52 |
+
* restricted-name = restricted-name-first *126restricted-name-chars
|
| 53 |
+
* restricted-name-first = ALPHA / DIGIT
|
| 54 |
+
* restricted-name-chars = ALPHA / DIGIT / "!" / "#" /
|
| 55 |
+
* "$" / "&" / "-" / "^" / "_"
|
| 56 |
+
* restricted-name-chars =/ "." ; Characters before first dot always
|
| 57 |
+
* ; specify a facet name
|
| 58 |
+
* restricted-name-chars =/ "+" ; Characters after last plus always
|
| 59 |
+
* ; specify a structured syntax suffix
|
| 60 |
+
* ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
|
| 61 |
+
* DIGIT = %x30-39 ; 0-9
|
| 62 |
+
*/
|
| 63 |
+
var subtypeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_.-]{0,126}$/
|
| 64 |
+
var typeNameRegExp = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/
|
| 65 |
+
var typeRegExp = /^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/;
|
| 66 |
+
|
| 67 |
+
/**
|
| 68 |
+
* Module exports.
|
| 69 |
+
*/
|
| 70 |
+
|
| 71 |
+
exports.format = format
|
| 72 |
+
exports.parse = parse
|
| 73 |
+
|
| 74 |
+
/**
|
| 75 |
+
* Format object to media type.
|
| 76 |
+
*
|
| 77 |
+
* @param {object} obj
|
| 78 |
+
* @return {string}
|
| 79 |
+
* @api public
|
| 80 |
+
*/
|
| 81 |
+
|
| 82 |
+
function format(obj) {
|
| 83 |
+
if (!obj || typeof obj !== 'object') {
|
| 84 |
+
throw new TypeError('argument obj is required')
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
var parameters = obj.parameters
|
| 88 |
+
var subtype = obj.subtype
|
| 89 |
+
var suffix = obj.suffix
|
| 90 |
+
var type = obj.type
|
| 91 |
+
|
| 92 |
+
if (!type || !typeNameRegExp.test(type)) {
|
| 93 |
+
throw new TypeError('invalid type')
|
| 94 |
+
}
|
| 95 |
+
|
| 96 |
+
if (!subtype || !subtypeNameRegExp.test(subtype)) {
|
| 97 |
+
throw new TypeError('invalid subtype')
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
// format as type/subtype
|
| 101 |
+
var string = type + '/' + subtype
|
| 102 |
+
|
| 103 |
+
// append +suffix
|
| 104 |
+
if (suffix) {
|
| 105 |
+
if (!typeNameRegExp.test(suffix)) {
|
| 106 |
+
throw new TypeError('invalid suffix')
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
string += '+' + suffix
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
// append parameters
|
| 113 |
+
if (parameters && typeof parameters === 'object') {
|
| 114 |
+
var param
|
| 115 |
+
var params = Object.keys(parameters).sort()
|
| 116 |
+
|
| 117 |
+
for (var i = 0; i < params.length; i++) {
|
| 118 |
+
param = params[i]
|
| 119 |
+
|
| 120 |
+
if (!tokenRegExp.test(param)) {
|
| 121 |
+
throw new TypeError('invalid parameter name')
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
string += '; ' + param + '=' + qstring(parameters[param])
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
return string
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
/**
|
| 132 |
+
* Parse media type to object.
|
| 133 |
+
*
|
| 134 |
+
* @param {string|object} string
|
| 135 |
+
* @return {Object}
|
| 136 |
+
* @api public
|
| 137 |
+
*/
|
| 138 |
+
|
| 139 |
+
function parse(string) {
|
| 140 |
+
if (!string) {
|
| 141 |
+
throw new TypeError('argument string is required')
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
// support req/res-like objects as argument
|
| 145 |
+
if (typeof string === 'object') {
|
| 146 |
+
string = getcontenttype(string)
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
if (typeof string !== 'string') {
|
| 150 |
+
throw new TypeError('argument string is required to be a string')
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
var index = string.indexOf(';')
|
| 154 |
+
var type = index !== -1
|
| 155 |
+
? string.substr(0, index)
|
| 156 |
+
: string
|
| 157 |
+
|
| 158 |
+
var key
|
| 159 |
+
var match
|
| 160 |
+
var obj = splitType(type)
|
| 161 |
+
var params = {}
|
| 162 |
+
var value
|
| 163 |
+
|
| 164 |
+
paramRegExp.lastIndex = index
|
| 165 |
+
|
| 166 |
+
while (match = paramRegExp.exec(string)) {
|
| 167 |
+
if (match.index !== index) {
|
| 168 |
+
throw new TypeError('invalid parameter format')
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
index += match[0].length
|
| 172 |
+
key = match[1].toLowerCase()
|
| 173 |
+
value = match[2]
|
| 174 |
+
|
| 175 |
+
if (value[0] === '"') {
|
| 176 |
+
// remove quotes and escapes
|
| 177 |
+
value = value
|
| 178 |
+
.substr(1, value.length - 2)
|
| 179 |
+
.replace(qescRegExp, '$1')
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
params[key] = value
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
if (index !== -1 && index !== string.length) {
|
| 186 |
+
throw new TypeError('invalid parameter format')
|
| 187 |
+
}
|
| 188 |
+
|
| 189 |
+
obj.parameters = params
|
| 190 |
+
|
| 191 |
+
return obj
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
/**
|
| 195 |
+
* Get content-type from req/res objects.
|
| 196 |
+
*
|
| 197 |
+
* @param {object}
|
| 198 |
+
* @return {Object}
|
| 199 |
+
* @api private
|
| 200 |
+
*/
|
| 201 |
+
|
| 202 |
+
function getcontenttype(obj) {
|
| 203 |
+
if (typeof obj.getHeader === 'function') {
|
| 204 |
+
// res-like
|
| 205 |
+
return obj.getHeader('content-type')
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
if (typeof obj.headers === 'object') {
|
| 209 |
+
// req-like
|
| 210 |
+
return obj.headers && obj.headers['content-type']
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
/**
|
| 215 |
+
* Quote a string if necessary.
|
| 216 |
+
*
|
| 217 |
+
* @param {string} val
|
| 218 |
+
* @return {string}
|
| 219 |
+
* @api private
|
| 220 |
+
*/
|
| 221 |
+
|
| 222 |
+
function qstring(val) {
|
| 223 |
+
var str = String(val)
|
| 224 |
+
|
| 225 |
+
// no need to quote tokens
|
| 226 |
+
if (tokenRegExp.test(str)) {
|
| 227 |
+
return str
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
if (str.length > 0 && !textRegExp.test(str)) {
|
| 231 |
+
throw new TypeError('invalid parameter value')
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
return '"' + str.replace(quoteRegExp, '\\$1') + '"'
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
/**
|
| 238 |
+
* Simply "type/subtype+siffx" into parts.
|
| 239 |
+
*
|
| 240 |
+
* @param {string} string
|
| 241 |
+
* @return {Object}
|
| 242 |
+
* @api private
|
| 243 |
+
*/
|
| 244 |
+
|
| 245 |
+
function splitType(string) {
|
| 246 |
+
var match = typeRegExp.exec(string.toLowerCase())
|
| 247 |
+
|
| 248 |
+
if (!match) {
|
| 249 |
+
throw new TypeError('invalid media type')
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
var type = match[1]
|
| 253 |
+
var subtype = match[2]
|
| 254 |
+
var suffix
|
| 255 |
+
|
| 256 |
+
// suffix after last +
|
| 257 |
+
var index = subtype.lastIndexOf('+')
|
| 258 |
+
if (index !== -1) {
|
| 259 |
+
suffix = subtype.substr(index + 1)
|
| 260 |
+
subtype = subtype.substr(0, index)
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
var obj = {
|
| 264 |
+
type: type,
|
| 265 |
+
subtype: subtype,
|
| 266 |
+
suffix: suffix
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
return obj
|
| 270 |
+
}
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/media-typer/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "media-typer",
|
| 3 |
+
"description": "Simple RFC 6838 media type parser and formatter",
|
| 4 |
+
"version": "0.3.0",
|
| 5 |
+
"author": {
|
| 6 |
+
"name": "Douglas Christopher Wilson",
|
| 7 |
+
"email": "doug@somethingdoug.com"
|
| 8 |
+
},
|
| 9 |
+
"license": "MIT",
|
| 10 |
+
"repository": {
|
| 11 |
+
"type": "git",
|
| 12 |
+
"url": "git+https://github.com/jshttp/media-typer.git"
|
| 13 |
+
},
|
| 14 |
+
"devDependencies": {
|
| 15 |
+
"istanbul": "0.3.2",
|
| 16 |
+
"mocha": "~1.21.4",
|
| 17 |
+
"should": "~4.0.4"
|
| 18 |
+
},
|
| 19 |
+
"files": [
|
| 20 |
+
"LICENSE",
|
| 21 |
+
"HISTORY.md",
|
| 22 |
+
"index.js"
|
| 23 |
+
],
|
| 24 |
+
"engines": {
|
| 25 |
+
"node": ">= 0.6"
|
| 26 |
+
},
|
| 27 |
+
"scripts": {
|
| 28 |
+
"test": "mocha --reporter spec --check-leaks --bail test/",
|
| 29 |
+
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
| 30 |
+
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
| 31 |
+
},
|
| 32 |
+
"gitHead": "d49d41ffd0bb5a0655fa44a59df2ec0bfc835b16",
|
| 33 |
+
"bugs": {
|
| 34 |
+
"url": "https://github.com/jshttp/media-typer/issues"
|
| 35 |
+
},
|
| 36 |
+
"homepage": "https://github.com/jshttp/media-typer",
|
| 37 |
+
"_id": "media-typer@0.3.0",
|
| 38 |
+
"_shasum": "8710d7af0aa626f8fffa1ce00168545263255748",
|
| 39 |
+
"_from": "media-typer@0.3.0",
|
| 40 |
+
"_npmVersion": "1.4.21",
|
| 41 |
+
"_npmUser": {
|
| 42 |
+
"name": "dougwilson",
|
| 43 |
+
"email": "doug@somethingdoug.com"
|
| 44 |
+
},
|
| 45 |
+
"maintainers": [
|
| 46 |
+
{
|
| 47 |
+
"name": "dougwilson",
|
| 48 |
+
"email": "doug@somethingdoug.com"
|
| 49 |
+
}
|
| 50 |
+
],
|
| 51 |
+
"dist": {
|
| 52 |
+
"shasum": "8710d7af0aa626f8fffa1ce00168545263255748",
|
| 53 |
+
"tarball": "http://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz"
|
| 54 |
+
},
|
| 55 |
+
"directories": {},
|
| 56 |
+
"_resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
| 57 |
+
"readme": "ERROR: No README data found!"
|
| 58 |
+
}
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/HISTORY.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2.0.12 / 2015-05-19
|
| 2 |
+
===================
|
| 3 |
+
|
| 4 |
+
* deps: mime-db@~1.10.0
|
| 5 |
+
- Add new mime types
|
| 6 |
+
|
| 7 |
+
2.0.11 / 2015-05-05
|
| 8 |
+
===================
|
| 9 |
+
|
| 10 |
+
* deps: mime-db@~1.9.1
|
| 11 |
+
- Add new mime types
|
| 12 |
+
|
| 13 |
+
2.0.10 / 2015-03-13
|
| 14 |
+
===================
|
| 15 |
+
|
| 16 |
+
* deps: mime-db@~1.8.0
|
| 17 |
+
- Add new mime types
|
| 18 |
+
|
| 19 |
+
2.0.9 / 2015-02-09
|
| 20 |
+
==================
|
| 21 |
+
|
| 22 |
+
* deps: mime-db@~1.7.0
|
| 23 |
+
- Add new mime types
|
| 24 |
+
- Community extensions ownership transferred from `node-mime`
|
| 25 |
+
|
| 26 |
+
2.0.8 / 2015-01-29
|
| 27 |
+
==================
|
| 28 |
+
|
| 29 |
+
* deps: mime-db@~1.6.0
|
| 30 |
+
- Add new mime types
|
| 31 |
+
|
| 32 |
+
2.0.7 / 2014-12-30
|
| 33 |
+
==================
|
| 34 |
+
|
| 35 |
+
* deps: mime-db@~1.5.0
|
| 36 |
+
- Add new mime types
|
| 37 |
+
- Fix various invalid MIME type entries
|
| 38 |
+
|
| 39 |
+
2.0.6 / 2014-12-30
|
| 40 |
+
==================
|
| 41 |
+
|
| 42 |
+
* deps: mime-db@~1.4.0
|
| 43 |
+
- Add new mime types
|
| 44 |
+
- Fix various invalid MIME type entries
|
| 45 |
+
- Remove example template MIME types
|
| 46 |
+
|
| 47 |
+
2.0.5 / 2014-12-29
|
| 48 |
+
==================
|
| 49 |
+
|
| 50 |
+
* deps: mime-db@~1.3.1
|
| 51 |
+
- Fix missing extensions
|
| 52 |
+
|
| 53 |
+
2.0.4 / 2014-12-10
|
| 54 |
+
==================
|
| 55 |
+
|
| 56 |
+
* deps: mime-db@~1.3.0
|
| 57 |
+
- Add new mime types
|
| 58 |
+
|
| 59 |
+
2.0.3 / 2014-11-09
|
| 60 |
+
==================
|
| 61 |
+
|
| 62 |
+
* deps: mime-db@~1.2.0
|
| 63 |
+
- Add new mime types
|
| 64 |
+
|
| 65 |
+
2.0.2 / 2014-09-28
|
| 66 |
+
==================
|
| 67 |
+
|
| 68 |
+
* deps: mime-db@~1.1.0
|
| 69 |
+
- Add new mime types
|
| 70 |
+
- Add additional compressible
|
| 71 |
+
- Update charsets
|
| 72 |
+
|
| 73 |
+
2.0.1 / 2014-09-07
|
| 74 |
+
==================
|
| 75 |
+
|
| 76 |
+
* Support Node.js 0.6
|
| 77 |
+
|
| 78 |
+
2.0.0 / 2014-09-02
|
| 79 |
+
==================
|
| 80 |
+
|
| 81 |
+
* Use `mime-db`
|
| 82 |
+
* Remove `.define()`
|
| 83 |
+
|
| 84 |
+
1.0.2 / 2014-08-04
|
| 85 |
+
==================
|
| 86 |
+
|
| 87 |
+
* Set charset=utf-8 for `text/javascript`
|
| 88 |
+
|
| 89 |
+
1.0.1 / 2014-06-24
|
| 90 |
+
==================
|
| 91 |
+
|
| 92 |
+
* Add `text/jsx` type
|
| 93 |
+
|
| 94 |
+
1.0.0 / 2014-05-12
|
| 95 |
+
==================
|
| 96 |
+
|
| 97 |
+
* Return `false` for unknown types
|
| 98 |
+
* Set charset=utf-8 for `application/json`
|
| 99 |
+
|
| 100 |
+
0.1.0 / 2014-05-02
|
| 101 |
+
==================
|
| 102 |
+
|
| 103 |
+
* Initial release
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
The MIT License (MIT)
|
| 3 |
+
|
| 4 |
+
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 7 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 8 |
+
in the Software without restriction, including without limitation the rights
|
| 9 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 10 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 11 |
+
furnished to do so, subject to the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be included in
|
| 14 |
+
all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 17 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 18 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 19 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 20 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 21 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 22 |
+
THE SOFTWARE.
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/README.md
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mime-types
|
| 2 |
+
|
| 3 |
+
[![NPM Version][npm-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][downloads-image]][downloads-url]
|
| 5 |
+
[![Node.js Version][node-version-image]][node-version-url]
|
| 6 |
+
[![Build Status][travis-image]][travis-url]
|
| 7 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
| 8 |
+
|
| 9 |
+
The ultimate javascript content-type utility.
|
| 10 |
+
|
| 11 |
+
Similar to [node-mime](https://github.com/broofa/node-mime), except:
|
| 12 |
+
|
| 13 |
+
- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`,
|
| 14 |
+
so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`.
|
| 15 |
+
- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`.
|
| 16 |
+
- Additional mime types are added such as jade and stylus via [mime-db](https://github.com/jshttp/mime-db)
|
| 17 |
+
- No `.define()` functionality
|
| 18 |
+
|
| 19 |
+
Otherwise, the API is compatible.
|
| 20 |
+
|
| 21 |
+
## Install
|
| 22 |
+
|
| 23 |
+
```sh
|
| 24 |
+
$ npm install mime-types
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
## Adding Types
|
| 28 |
+
|
| 29 |
+
All mime types are based on [mime-db](https://github.com/jshttp/mime-db),
|
| 30 |
+
so open a PR there if you'd like to add mime types.
|
| 31 |
+
|
| 32 |
+
## API
|
| 33 |
+
|
| 34 |
+
```js
|
| 35 |
+
var mime = require('mime-types')
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
All functions return `false` if input is invalid or not found.
|
| 39 |
+
|
| 40 |
+
### mime.lookup(path)
|
| 41 |
+
|
| 42 |
+
Lookup the content-type associated with a file.
|
| 43 |
+
|
| 44 |
+
```js
|
| 45 |
+
mime.lookup('json') // 'application/json'
|
| 46 |
+
mime.lookup('.md') // 'text/x-markdown'
|
| 47 |
+
mime.lookup('file.html') // 'text/html'
|
| 48 |
+
mime.lookup('folder/file.js') // 'application/javascript'
|
| 49 |
+
|
| 50 |
+
mime.lookup('cats') // false
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
### mime.contentType(type)
|
| 54 |
+
|
| 55 |
+
Create a full content-type header given a content-type or extension.
|
| 56 |
+
|
| 57 |
+
```js
|
| 58 |
+
mime.contentType('markdown') // 'text/x-markdown; charset=utf-8'
|
| 59 |
+
mime.contentType('file.json') // 'application/json; charset=utf-8'
|
| 60 |
+
|
| 61 |
+
// from a full path
|
| 62 |
+
mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8'
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
### mime.extension(type)
|
| 66 |
+
|
| 67 |
+
Get the default extension for a content-type.
|
| 68 |
+
|
| 69 |
+
```js
|
| 70 |
+
mime.extension('application/octet-stream') // 'bin'
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
### mime.charset(type)
|
| 74 |
+
|
| 75 |
+
Lookup the implied default charset of a content-type.
|
| 76 |
+
|
| 77 |
+
```js
|
| 78 |
+
mime.charset('text/x-markdown') // 'UTF-8'
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
### var type = mime.types[extension]
|
| 82 |
+
|
| 83 |
+
A map of content-types by extension.
|
| 84 |
+
|
| 85 |
+
### [extensions...] = mime.extensions[type]
|
| 86 |
+
|
| 87 |
+
A map of extensions by content-type.
|
| 88 |
+
|
| 89 |
+
## License
|
| 90 |
+
|
| 91 |
+
[MIT](LICENSE)
|
| 92 |
+
|
| 93 |
+
[npm-image]: https://img.shields.io/npm/v/mime-types.svg
|
| 94 |
+
[npm-url]: https://npmjs.org/package/mime-types
|
| 95 |
+
[node-version-image]: https://img.shields.io/node/v/mime-types.svg
|
| 96 |
+
[node-version-url]: http://nodejs.org/download/
|
| 97 |
+
[travis-image]: https://img.shields.io/travis/jshttp/mime-types/master.svg
|
| 98 |
+
[travis-url]: https://travis-ci.org/jshttp/mime-types
|
| 99 |
+
[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-types/master.svg
|
| 100 |
+
[coveralls-url]: https://coveralls.io/r/jshttp/mime-types
|
| 101 |
+
[downloads-image]: https://img.shields.io/npm/dm/mime-types.svg
|
| 102 |
+
[downloads-url]: https://npmjs.org/package/mime-types
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/index.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
var db = require('mime-db')
|
| 3 |
+
|
| 4 |
+
// types[extension] = type
|
| 5 |
+
exports.types = Object.create(null)
|
| 6 |
+
// extensions[type] = [extensions]
|
| 7 |
+
exports.extensions = Object.create(null)
|
| 8 |
+
|
| 9 |
+
Object.keys(db).forEach(function (name) {
|
| 10 |
+
var mime = db[name]
|
| 11 |
+
var exts = mime.extensions
|
| 12 |
+
if (!exts || !exts.length) return
|
| 13 |
+
exports.extensions[name] = exts
|
| 14 |
+
exts.forEach(function (ext) {
|
| 15 |
+
exports.types[ext] = name
|
| 16 |
+
})
|
| 17 |
+
})
|
| 18 |
+
|
| 19 |
+
exports.lookup = function (string) {
|
| 20 |
+
if (!string || typeof string !== "string") return false
|
| 21 |
+
// remove any leading paths, though we should just use path.basename
|
| 22 |
+
string = string.replace(/.*[\.\/\\]/, '').toLowerCase()
|
| 23 |
+
if (!string) return false
|
| 24 |
+
return exports.types[string] || false
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
exports.extension = function (type) {
|
| 28 |
+
if (!type || typeof type !== "string") return false
|
| 29 |
+
// to do: use media-typer
|
| 30 |
+
type = type.match(/^\s*([^;\s]*)(?:;|\s|$)/)
|
| 31 |
+
if (!type) return false
|
| 32 |
+
var exts = exports.extensions[type[1].toLowerCase()]
|
| 33 |
+
if (!exts || !exts.length) return false
|
| 34 |
+
return exts[0]
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// type has to be an exact mime type
|
| 38 |
+
exports.charset = function (type) {
|
| 39 |
+
var mime = db[type]
|
| 40 |
+
if (mime && mime.charset) return mime.charset
|
| 41 |
+
|
| 42 |
+
// default text/* to utf-8
|
| 43 |
+
if (/^text\//.test(type)) return 'UTF-8'
|
| 44 |
+
|
| 45 |
+
return false
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
// backwards compatibility
|
| 49 |
+
exports.charsets = {
|
| 50 |
+
lookup: exports.charset
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
// to do: maybe use set-type module or something
|
| 54 |
+
exports.contentType = function (type) {
|
| 55 |
+
if (!type || typeof type !== "string") return false
|
| 56 |
+
if (!~type.indexOf('/')) type = exports.lookup(type)
|
| 57 |
+
if (!type) return false
|
| 58 |
+
if (!~type.indexOf('charset')) {
|
| 59 |
+
var charset = exports.charset(type)
|
| 60 |
+
if (charset) type += '; charset=' + charset.toLowerCase()
|
| 61 |
+
}
|
| 62 |
+
return type
|
| 63 |
+
}
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/HISTORY.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1.10.0 / 2015-05-19
|
| 2 |
+
===================
|
| 3 |
+
|
| 4 |
+
* Add `application/vnd.balsamiq.bmpr`
|
| 5 |
+
* Add `application/vnd.microsoft.portable-executable`
|
| 6 |
+
* Add `application/x-ns-proxy-autoconfig`
|
| 7 |
+
|
| 8 |
+
1.9.1 / 2015-04-19
|
| 9 |
+
==================
|
| 10 |
+
|
| 11 |
+
* Remove `.json` extension from `application/manifest+json`
|
| 12 |
+
- This is causing bugs downstream
|
| 13 |
+
|
| 14 |
+
1.9.0 / 2015-04-19
|
| 15 |
+
==================
|
| 16 |
+
|
| 17 |
+
* Add `application/manifest+json`
|
| 18 |
+
* Add `application/vnd.micro+json`
|
| 19 |
+
* Add `image/vnd.zbrush.pcx`
|
| 20 |
+
* Add `image/x-ms-bmp`
|
| 21 |
+
|
| 22 |
+
1.8.0 / 2015-03-13
|
| 23 |
+
==================
|
| 24 |
+
|
| 25 |
+
* Add `application/vnd.citationstyles.style+xml`
|
| 26 |
+
* Add `application/vnd.fastcopy-disk-image`
|
| 27 |
+
* Add `application/vnd.gov.sk.xmldatacontainer+xml`
|
| 28 |
+
* Add extension `.jsonld` to `application/ld+json`
|
| 29 |
+
|
| 30 |
+
1.7.0 / 2015-02-08
|
| 31 |
+
==================
|
| 32 |
+
|
| 33 |
+
* Add `application/vnd.gerber`
|
| 34 |
+
* Add `application/vnd.msa-disk-image`
|
| 35 |
+
|
| 36 |
+
1.6.1 / 2015-02-05
|
| 37 |
+
==================
|
| 38 |
+
|
| 39 |
+
* Community extensions ownership transferred from `node-mime`
|
| 40 |
+
|
| 41 |
+
1.6.0 / 2015-01-29
|
| 42 |
+
==================
|
| 43 |
+
|
| 44 |
+
* Add `application/jose`
|
| 45 |
+
* Add `application/jose+json`
|
| 46 |
+
* Add `application/json-seq`
|
| 47 |
+
* Add `application/jwk+json`
|
| 48 |
+
* Add `application/jwk-set+json`
|
| 49 |
+
* Add `application/jwt`
|
| 50 |
+
* Add `application/rdap+json`
|
| 51 |
+
* Add `application/vnd.gov.sk.e-form+xml`
|
| 52 |
+
* Add `application/vnd.ims.imsccv1p3`
|
| 53 |
+
|
| 54 |
+
1.5.0 / 2014-12-30
|
| 55 |
+
==================
|
| 56 |
+
|
| 57 |
+
* Add `application/vnd.oracle.resource+json`
|
| 58 |
+
* Fix various invalid MIME type entries
|
| 59 |
+
- `application/mbox+xml`
|
| 60 |
+
- `application/oscp-response`
|
| 61 |
+
- `application/vwg-multiplexed`
|
| 62 |
+
- `audio/g721`
|
| 63 |
+
|
| 64 |
+
1.4.0 / 2014-12-21
|
| 65 |
+
==================
|
| 66 |
+
|
| 67 |
+
* Add `application/vnd.ims.imsccv1p2`
|
| 68 |
+
* Fix various invalid MIME type entries
|
| 69 |
+
- `application/vnd-acucobol`
|
| 70 |
+
- `application/vnd-curl`
|
| 71 |
+
- `application/vnd-dart`
|
| 72 |
+
- `application/vnd-dxr`
|
| 73 |
+
- `application/vnd-fdf`
|
| 74 |
+
- `application/vnd-mif`
|
| 75 |
+
- `application/vnd-sema`
|
| 76 |
+
- `application/vnd-wap-wmlc`
|
| 77 |
+
- `application/vnd.adobe.flash-movie`
|
| 78 |
+
- `application/vnd.dece-zip`
|
| 79 |
+
- `application/vnd.dvb_service`
|
| 80 |
+
- `application/vnd.micrografx-igx`
|
| 81 |
+
- `application/vnd.sealed-doc`
|
| 82 |
+
- `application/vnd.sealed-eml`
|
| 83 |
+
- `application/vnd.sealed-mht`
|
| 84 |
+
- `application/vnd.sealed-ppt`
|
| 85 |
+
- `application/vnd.sealed-tiff`
|
| 86 |
+
- `application/vnd.sealed-xls`
|
| 87 |
+
- `application/vnd.sealedmedia.softseal-html`
|
| 88 |
+
- `application/vnd.sealedmedia.softseal-pdf`
|
| 89 |
+
- `application/vnd.wap-slc`
|
| 90 |
+
- `application/vnd.wap-wbxml`
|
| 91 |
+
- `audio/vnd.sealedmedia.softseal-mpeg`
|
| 92 |
+
- `image/vnd-djvu`
|
| 93 |
+
- `image/vnd-svf`
|
| 94 |
+
- `image/vnd-wap-wbmp`
|
| 95 |
+
- `image/vnd.sealed-png`
|
| 96 |
+
- `image/vnd.sealedmedia.softseal-gif`
|
| 97 |
+
- `image/vnd.sealedmedia.softseal-jpg`
|
| 98 |
+
- `model/vnd-dwf`
|
| 99 |
+
- `model/vnd.parasolid.transmit-binary`
|
| 100 |
+
- `model/vnd.parasolid.transmit-text`
|
| 101 |
+
- `text/vnd-a`
|
| 102 |
+
- `text/vnd-curl`
|
| 103 |
+
- `text/vnd.wap-wml`
|
| 104 |
+
* Remove example template MIME types
|
| 105 |
+
- `application/example`
|
| 106 |
+
- `audio/example`
|
| 107 |
+
- `image/example`
|
| 108 |
+
- `message/example`
|
| 109 |
+
- `model/example`
|
| 110 |
+
- `multipart/example`
|
| 111 |
+
- `text/example`
|
| 112 |
+
- `video/example`
|
| 113 |
+
|
| 114 |
+
1.3.1 / 2014-12-16
|
| 115 |
+
==================
|
| 116 |
+
|
| 117 |
+
* Fix missing extensions
|
| 118 |
+
- `application/json5`
|
| 119 |
+
- `text/hjson`
|
| 120 |
+
|
| 121 |
+
1.3.0 / 2014-12-07
|
| 122 |
+
==================
|
| 123 |
+
|
| 124 |
+
* Add `application/a2l`
|
| 125 |
+
* Add `application/aml`
|
| 126 |
+
* Add `application/atfx`
|
| 127 |
+
* Add `application/atxml`
|
| 128 |
+
* Add `application/cdfx+xml`
|
| 129 |
+
* Add `application/dii`
|
| 130 |
+
* Add `application/json5`
|
| 131 |
+
* Add `application/lxf`
|
| 132 |
+
* Add `application/mf4`
|
| 133 |
+
* Add `application/vnd.apache.thrift.compact`
|
| 134 |
+
* Add `application/vnd.apache.thrift.json`
|
| 135 |
+
* Add `application/vnd.coffeescript`
|
| 136 |
+
* Add `application/vnd.enphase.envoy`
|
| 137 |
+
* Add `application/vnd.ims.imsccv1p1`
|
| 138 |
+
* Add `text/csv-schema`
|
| 139 |
+
* Add `text/hjson`
|
| 140 |
+
* Add `text/markdown`
|
| 141 |
+
* Add `text/yaml`
|
| 142 |
+
|
| 143 |
+
1.2.0 / 2014-11-09
|
| 144 |
+
==================
|
| 145 |
+
|
| 146 |
+
* Add `application/cea`
|
| 147 |
+
* Add `application/dit`
|
| 148 |
+
* Add `application/vnd.gov.sk.e-form+zip`
|
| 149 |
+
* Add `application/vnd.tmd.mediaflex.api+xml`
|
| 150 |
+
* Type `application/epub+zip` is now IANA-registered
|
| 151 |
+
|
| 152 |
+
1.1.2 / 2014-10-23
|
| 153 |
+
==================
|
| 154 |
+
|
| 155 |
+
* Rebuild database for `application/x-www-form-urlencoded` change
|
| 156 |
+
|
| 157 |
+
1.1.1 / 2014-10-20
|
| 158 |
+
==================
|
| 159 |
+
|
| 160 |
+
* Mark `application/x-www-form-urlencoded` as compressible.
|
| 161 |
+
|
| 162 |
+
1.1.0 / 2014-09-28
|
| 163 |
+
==================
|
| 164 |
+
|
| 165 |
+
* Add `application/font-woff2`
|
| 166 |
+
|
| 167 |
+
1.0.3 / 2014-09-25
|
| 168 |
+
==================
|
| 169 |
+
|
| 170 |
+
* Fix engine requirement in package
|
| 171 |
+
|
| 172 |
+
1.0.2 / 2014-09-25
|
| 173 |
+
==================
|
| 174 |
+
|
| 175 |
+
* Add `application/coap-group+json`
|
| 176 |
+
* Add `application/dcd`
|
| 177 |
+
* Add `application/vnd.apache.thrift.binary`
|
| 178 |
+
* Add `image/vnd.tencent.tap`
|
| 179 |
+
* Mark all JSON-derived types as compressible
|
| 180 |
+
* Update `text/vtt` data
|
| 181 |
+
|
| 182 |
+
1.0.1 / 2014-08-30
|
| 183 |
+
==================
|
| 184 |
+
|
| 185 |
+
* Fix extension ordering
|
| 186 |
+
|
| 187 |
+
1.0.0 / 2014-08-30
|
| 188 |
+
==================
|
| 189 |
+
|
| 190 |
+
* Add `application/atf`
|
| 191 |
+
* Add `application/merge-patch+json`
|
| 192 |
+
* Add `multipart/x-mixed-replace`
|
| 193 |
+
* Add `source: 'apache'` metadata
|
| 194 |
+
* Add `source: 'iana'` metadata
|
| 195 |
+
* Remove badly-assumed charset data
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
The MIT License (MIT)
|
| 3 |
+
|
| 4 |
+
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 7 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 8 |
+
in the Software without restriction, including without limitation the rights
|
| 9 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 10 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 11 |
+
furnished to do so, subject to the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be included in
|
| 14 |
+
all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 17 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 18 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 19 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 20 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 21 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 22 |
+
THE SOFTWARE.
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/README.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# mime-db
|
| 2 |
+
|
| 3 |
+
[![NPM Version][npm-version-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][npm-downloads-image]][npm-url]
|
| 5 |
+
[![Node.js Version][node-image]][node-url]
|
| 6 |
+
[![Build Status][travis-image]][travis-url]
|
| 7 |
+
[![Coverage Status][coveralls-image]][coveralls-url]
|
| 8 |
+
|
| 9 |
+
This is a database of all mime types.
|
| 10 |
+
It consists of a single, public JSON file and does not include any logic,
|
| 11 |
+
allowing it to remain as un-opinionated as possible with an API.
|
| 12 |
+
It aggregates data from the following sources:
|
| 13 |
+
|
| 14 |
+
- http://www.iana.org/assignments/media-types/media-types.xhtml
|
| 15 |
+
- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
|
| 16 |
+
|
| 17 |
+
## Installation
|
| 18 |
+
|
| 19 |
+
```bash
|
| 20 |
+
npm install mime-db
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
If you're crazy enough to use this in the browser,
|
| 24 |
+
you can just grab the JSON file:
|
| 25 |
+
|
| 26 |
+
```
|
| 27 |
+
https://cdn.rawgit.com/jshttp/mime-db/master/db.json
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
|
| 32 |
+
```js
|
| 33 |
+
var db = require('mime-db');
|
| 34 |
+
|
| 35 |
+
// grab data on .js files
|
| 36 |
+
var data = db['application/javascript'];
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Data Structure
|
| 40 |
+
|
| 41 |
+
The JSON file is a map lookup for lowercased mime types.
|
| 42 |
+
Each mime type has the following properties:
|
| 43 |
+
|
| 44 |
+
- `.source` - where the mime type is defined.
|
| 45 |
+
If not set, it's probably a custom media type.
|
| 46 |
+
- `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types)
|
| 47 |
+
- `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml)
|
| 48 |
+
- `.extensions[]` - known extensions associated with this mime type.
|
| 49 |
+
- `.compressible` - whether a file of this type is can be gzipped.
|
| 50 |
+
- `.charset` - the default charset associated with this type, if any.
|
| 51 |
+
|
| 52 |
+
If unknown, every property could be `undefined`.
|
| 53 |
+
|
| 54 |
+
## Contributing
|
| 55 |
+
|
| 56 |
+
To edit the database, only make PRs against `src/custom.json` or
|
| 57 |
+
`src/custom-suffix.json`.
|
| 58 |
+
|
| 59 |
+
To update the build, run `npm run update`.
|
| 60 |
+
|
| 61 |
+
## Adding Custom Media Types
|
| 62 |
+
|
| 63 |
+
The best way to get new media types included in this library is to register
|
| 64 |
+
them with the IANA. The community registration procedure is outlined in
|
| 65 |
+
[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types
|
| 66 |
+
registered with the IANA are automatically pulled into this library.
|
| 67 |
+
|
| 68 |
+
[npm-version-image]: https://img.shields.io/npm/v/mime-db.svg
|
| 69 |
+
[npm-downloads-image]: https://img.shields.io/npm/dm/mime-db.svg
|
| 70 |
+
[npm-url]: https://npmjs.org/package/mime-db
|
| 71 |
+
[travis-image]: https://img.shields.io/travis/jshttp/mime-db/master.svg
|
| 72 |
+
[travis-url]: https://travis-ci.org/jshttp/mime-db
|
| 73 |
+
[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-db/master.svg
|
| 74 |
+
[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master
|
| 75 |
+
[node-image]: https://img.shields.io/node/v/mime-db.svg
|
| 76 |
+
[node-url]: http://nodejs.org/download/
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/db.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* mime-db
|
| 3 |
+
* Copyright(c) 2014 Jonathan Ong
|
| 4 |
+
* MIT Licensed
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* Module exports.
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
module.exports = require('./db.json')
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/package.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "mime-db",
|
| 3 |
+
"description": "Media Type Database",
|
| 4 |
+
"version": "1.10.0",
|
| 5 |
+
"contributors": [
|
| 6 |
+
{
|
| 7 |
+
"name": "Douglas Christopher Wilson",
|
| 8 |
+
"email": "doug@somethingdoug.com"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"name": "Jonathan Ong",
|
| 12 |
+
"email": "me@jongleberry.com",
|
| 13 |
+
"url": "http://jongleberry.com"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"name": "Robert Kieffer",
|
| 17 |
+
"email": "robert@broofa.com",
|
| 18 |
+
"url": "http://github.com/broofa"
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"license": "MIT",
|
| 22 |
+
"keywords": [
|
| 23 |
+
"mime",
|
| 24 |
+
"db",
|
| 25 |
+
"type",
|
| 26 |
+
"types",
|
| 27 |
+
"database",
|
| 28 |
+
"charset",
|
| 29 |
+
"charsets"
|
| 30 |
+
],
|
| 31 |
+
"repository": {
|
| 32 |
+
"type": "git",
|
| 33 |
+
"url": "git+https://github.com/jshttp/mime-db.git"
|
| 34 |
+
},
|
| 35 |
+
"devDependencies": {
|
| 36 |
+
"bluebird": "~2.9.20",
|
| 37 |
+
"co": "4.5.4",
|
| 38 |
+
"cogent": "1.0.1",
|
| 39 |
+
"csv-parse": "0.1.1",
|
| 40 |
+
"gnode": "0.1.1",
|
| 41 |
+
"istanbul": "0.3.9",
|
| 42 |
+
"mocha": "1.21.5",
|
| 43 |
+
"raw-body": "2.0.1",
|
| 44 |
+
"stream-to-array": "2"
|
| 45 |
+
},
|
| 46 |
+
"files": [
|
| 47 |
+
"HISTORY.md",
|
| 48 |
+
"LICENSE",
|
| 49 |
+
"README.md",
|
| 50 |
+
"db.json",
|
| 51 |
+
"index.js"
|
| 52 |
+
],
|
| 53 |
+
"engines": {
|
| 54 |
+
"node": ">= 0.6"
|
| 55 |
+
},
|
| 56 |
+
"scripts": {
|
| 57 |
+
"build": "node scripts/build",
|
| 58 |
+
"fetch": "gnode scripts/extensions && gnode scripts/types",
|
| 59 |
+
"test": "mocha --reporter spec --bail --check-leaks test/",
|
| 60 |
+
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
| 61 |
+
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/",
|
| 62 |
+
"update": "npm run fetch && npm run build"
|
| 63 |
+
},
|
| 64 |
+
"gitHead": "260552f9177fe78986b92699999f81999c7fe43c",
|
| 65 |
+
"bugs": {
|
| 66 |
+
"url": "https://github.com/jshttp/mime-db/issues"
|
| 67 |
+
},
|
| 68 |
+
"homepage": "https://github.com/jshttp/mime-db",
|
| 69 |
+
"_id": "mime-db@1.10.0",
|
| 70 |
+
"_shasum": "e6308063c758ebd12837874c3d1ea9170766b03b",
|
| 71 |
+
"_from": "mime-db@>=1.10.0 <1.11.0",
|
| 72 |
+
"_npmVersion": "1.4.28",
|
| 73 |
+
"_npmUser": {
|
| 74 |
+
"name": "dougwilson",
|
| 75 |
+
"email": "doug@somethingdoug.com"
|
| 76 |
+
},
|
| 77 |
+
"maintainers": [
|
| 78 |
+
{
|
| 79 |
+
"name": "jongleberry",
|
| 80 |
+
"email": "jonathanrichardong@gmail.com"
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"name": "dougwilson",
|
| 84 |
+
"email": "doug@somethingdoug.com"
|
| 85 |
+
}
|
| 86 |
+
],
|
| 87 |
+
"dist": {
|
| 88 |
+
"shasum": "e6308063c758ebd12837874c3d1ea9170766b03b",
|
| 89 |
+
"tarball": "http://registry.npmjs.org/mime-db/-/mime-db-1.10.0.tgz"
|
| 90 |
+
},
|
| 91 |
+
"directories": {},
|
| 92 |
+
"_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.10.0.tgz",
|
| 93 |
+
"readme": "ERROR: No README data found!"
|
| 94 |
+
}
|
5485-master/demos/node_modules/express/node_modules/type-is/node_modules/mime-types/package.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "mime-types",
|
| 3 |
+
"description": "The ultimate javascript content-type utility.",
|
| 4 |
+
"version": "2.0.12",
|
| 5 |
+
"contributors": [
|
| 6 |
+
{
|
| 7 |
+
"name": "Douglas Christopher Wilson",
|
| 8 |
+
"email": "doug@somethingdoug.com"
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"name": "Jeremiah Senkpiel",
|
| 12 |
+
"email": "fishrock123@rocketmail.com",
|
| 13 |
+
"url": "https://searchbeam.jit.su"
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"name": "Jonathan Ong",
|
| 17 |
+
"email": "me@jongleberry.com",
|
| 18 |
+
"url": "http://jongleberry.com"
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"license": "MIT",
|
| 22 |
+
"keywords": [
|
| 23 |
+
"mime",
|
| 24 |
+
"types"
|
| 25 |
+
],
|
| 26 |
+
"repository": {
|
| 27 |
+
"type": "git",
|
| 28 |
+
"url": "git+https://github.com/jshttp/mime-types.git"
|
| 29 |
+
},
|
| 30 |
+
"dependencies": {
|
| 31 |
+
"mime-db": "~1.10.0"
|
| 32 |
+
},
|
| 33 |
+
"devDependencies": {
|
| 34 |
+
"istanbul": "0.3.9",
|
| 35 |
+
"mocha": "~1.21.5"
|
| 36 |
+
},
|
| 37 |
+
"files": [
|
| 38 |
+
"HISTORY.md",
|
| 39 |
+
"LICENSE",
|
| 40 |
+
"index.js"
|
| 41 |
+
],
|
| 42 |
+
"engines": {
|
| 43 |
+
"node": ">= 0.6"
|
| 44 |
+
},
|
| 45 |
+
"scripts": {
|
| 46 |
+
"test": "mocha --reporter spec test/test.js",
|
| 47 |
+
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js",
|
| 48 |
+
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js"
|
| 49 |
+
},
|
| 50 |
+
"gitHead": "a1e3c4b6bbb6afb615c8a058481d58cb57a4cb95",
|
| 51 |
+
"bugs": {
|
| 52 |
+
"url": "https://github.com/jshttp/mime-types/issues"
|
| 53 |
+
},
|
| 54 |
+
"homepage": "https://github.com/jshttp/mime-types",
|
| 55 |
+
"_id": "mime-types@2.0.12",
|
| 56 |
+
"_shasum": "87ae9f124e94f8e440c93d1a72d0dccecdb71135",
|
| 57 |
+
"_from": "mime-types@>=2.0.11 <2.1.0",
|
| 58 |
+
"_npmVersion": "1.4.28",
|
| 59 |
+
"_npmUser": {
|
| 60 |
+
"name": "dougwilson",
|
| 61 |
+
"email": "doug@somethingdoug.com"
|
| 62 |
+
},
|
| 63 |
+
"maintainers": [
|
| 64 |
+
{
|
| 65 |
+
"name": "jongleberry",
|
| 66 |
+
"email": "jonathanrichardong@gmail.com"
|
| 67 |
+
},
|
| 68 |
+
{
|
| 69 |
+
"name": "fishrock123",
|
| 70 |
+
"email": "fishrock123@rocketmail.com"
|
| 71 |
+
},
|
| 72 |
+
{
|
| 73 |
+
"name": "dougwilson",
|
| 74 |
+
"email": "doug@somethingdoug.com"
|
| 75 |
+
}
|
| 76 |
+
],
|
| 77 |
+
"dist": {
|
| 78 |
+
"shasum": "87ae9f124e94f8e440c93d1a72d0dccecdb71135",
|
| 79 |
+
"tarball": "http://registry.npmjs.org/mime-types/-/mime-types-2.0.12.tgz"
|
| 80 |
+
},
|
| 81 |
+
"directories": {},
|
| 82 |
+
"_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.0.12.tgz",
|
| 83 |
+
"readme": "ERROR: No README data found!"
|
| 84 |
+
}
|
5485-master/demos/node_modules/express/node_modules/type-is/package.json
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "type-is",
|
| 3 |
+
"description": "Infer the content-type of a request.",
|
| 4 |
+
"version": "1.6.2",
|
| 5 |
+
"author": {
|
| 6 |
+
"name": "Jonathan Ong",
|
| 7 |
+
"email": "me@jongleberry.com",
|
| 8 |
+
"url": "http://jongleberry.com"
|
| 9 |
+
},
|
| 10 |
+
"contributors": [
|
| 11 |
+
{
|
| 12 |
+
"name": "Douglas Christopher Wilson",
|
| 13 |
+
"email": "doug@somethingdoug.com"
|
| 14 |
+
}
|
| 15 |
+
],
|
| 16 |
+
"license": "MIT",
|
| 17 |
+
"repository": {
|
| 18 |
+
"type": "git",
|
| 19 |
+
"url": "git+https://github.com/jshttp/type-is.git"
|
| 20 |
+
},
|
| 21 |
+
"dependencies": {
|
| 22 |
+
"media-typer": "0.3.0",
|
| 23 |
+
"mime-types": "~2.0.11"
|
| 24 |
+
},
|
| 25 |
+
"devDependencies": {
|
| 26 |
+
"istanbul": "0.3.9",
|
| 27 |
+
"mocha": "~1.21.5"
|
| 28 |
+
},
|
| 29 |
+
"engines": {
|
| 30 |
+
"node": ">= 0.6"
|
| 31 |
+
},
|
| 32 |
+
"files": [
|
| 33 |
+
"LICENSE",
|
| 34 |
+
"HISTORY.md",
|
| 35 |
+
"index.js"
|
| 36 |
+
],
|
| 37 |
+
"scripts": {
|
| 38 |
+
"test": "mocha --reporter spec --check-leaks --bail test/",
|
| 39 |
+
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
| 40 |
+
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
| 41 |
+
},
|
| 42 |
+
"keywords": [
|
| 43 |
+
"content",
|
| 44 |
+
"type",
|
| 45 |
+
"checking"
|
| 46 |
+
],
|
| 47 |
+
"gitHead": "4e33e2fbb1f0daa6ec8c5444dbb60e44292ae314",
|
| 48 |
+
"bugs": {
|
| 49 |
+
"url": "https://github.com/jshttp/type-is/issues"
|
| 50 |
+
},
|
| 51 |
+
"homepage": "https://github.com/jshttp/type-is",
|
| 52 |
+
"_id": "type-is@1.6.2",
|
| 53 |
+
"_shasum": "694e83e5d110417e681cea278227f264ae406e33",
|
| 54 |
+
"_from": "type-is@>=1.6.2 <1.7.0",
|
| 55 |
+
"_npmVersion": "1.4.28",
|
| 56 |
+
"_npmUser": {
|
| 57 |
+
"name": "dougwilson",
|
| 58 |
+
"email": "doug@somethingdoug.com"
|
| 59 |
+
},
|
| 60 |
+
"maintainers": [
|
| 61 |
+
{
|
| 62 |
+
"name": "jongleberry",
|
| 63 |
+
"email": "jonathanrichardong@gmail.com"
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"name": "dougwilson",
|
| 67 |
+
"email": "doug@somethingdoug.com"
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"name": "tjholowaychuk",
|
| 71 |
+
"email": "tj@vision-media.ca"
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"name": "mscdex",
|
| 75 |
+
"email": "mscdex@mscdex.net"
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"name": "fishrock123",
|
| 79 |
+
"email": "fishrock123@rocketmail.com"
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"name": "defunctzombie",
|
| 83 |
+
"email": "shtylman@gmail.com"
|
| 84 |
+
}
|
| 85 |
+
],
|
| 86 |
+
"dist": {
|
| 87 |
+
"shasum": "694e83e5d110417e681cea278227f264ae406e33",
|
| 88 |
+
"tarball": "http://registry.npmjs.org/type-is/-/type-is-1.6.2.tgz"
|
| 89 |
+
},
|
| 90 |
+
"directories": {},
|
| 91 |
+
"_resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.2.tgz",
|
| 92 |
+
"readme": "ERROR: No README data found!"
|
| 93 |
+
}
|
5485-master/demos/node_modules/express/node_modules/utils-merge/.travis.yml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
language: "node_js"
|
| 2 |
+
node_js:
|
| 3 |
+
- "0.4"
|
| 4 |
+
- "0.6"
|
| 5 |
+
- "0.8"
|
| 6 |
+
- "0.10"
|
5485-master/demos/node_modules/express/node_modules/utils-merge/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2013 Jared Hanson
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
| 6 |
+
this software and associated documentation files (the "Software"), to deal in
|
| 7 |
+
the Software without restriction, including without limitation the rights to
|
| 8 |
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
| 9 |
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
| 10 |
+
subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
| 17 |
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
| 18 |
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
| 19 |
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
| 20 |
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
5485-master/demos/node_modules/express/node_modules/utils-merge/README.md
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# utils-merge
|
| 2 |
+
|
| 3 |
+
Merges the properties from a source object into a destination object.
|
| 4 |
+
|
| 5 |
+
## Install
|
| 6 |
+
|
| 7 |
+
$ npm install utils-merge
|
| 8 |
+
|
| 9 |
+
## Usage
|
| 10 |
+
|
| 11 |
+
```javascript
|
| 12 |
+
var a = { foo: 'bar' }
|
| 13 |
+
, b = { bar: 'baz' };
|
| 14 |
+
|
| 15 |
+
merge(a, b);
|
| 16 |
+
// => { foo: 'bar', bar: 'baz' }
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
## Tests
|
| 20 |
+
|
| 21 |
+
$ npm install
|
| 22 |
+
$ npm test
|
| 23 |
+
|
| 24 |
+
[](http://travis-ci.org/jaredhanson/utils-merge)
|
| 25 |
+
|
| 26 |
+
## Credits
|
| 27 |
+
|
| 28 |
+
- [Jared Hanson](http://github.com/jaredhanson)
|
| 29 |
+
|
| 30 |
+
## License
|
| 31 |
+
|
| 32 |
+
[The MIT License](http://opensource.org/licenses/MIT)
|
| 33 |
+
|
| 34 |
+
Copyright (c) 2013 Jared Hanson <[http://jaredhanson.net/](http://jaredhanson.net/)>
|
5485-master/demos/node_modules/express/node_modules/utils-merge/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Merge object b with object a.
|
| 3 |
+
*
|
| 4 |
+
* var a = { foo: 'bar' }
|
| 5 |
+
* , b = { bar: 'baz' };
|
| 6 |
+
*
|
| 7 |
+
* merge(a, b);
|
| 8 |
+
* // => { foo: 'bar', bar: 'baz' }
|
| 9 |
+
*
|
| 10 |
+
* @param {Object} a
|
| 11 |
+
* @param {Object} b
|
| 12 |
+
* @return {Object}
|
| 13 |
+
* @api public
|
| 14 |
+
*/
|
| 15 |
+
|
| 16 |
+
exports = module.exports = function(a, b){
|
| 17 |
+
if (a && b) {
|
| 18 |
+
for (var key in b) {
|
| 19 |
+
a[key] = b[key];
|
| 20 |
+
}
|
| 21 |
+
}
|
| 22 |
+
return a;
|
| 23 |
+
};
|
5485-master/demos/node_modules/express/node_modules/utils-merge/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "utils-merge",
|
| 3 |
+
"version": "1.0.0",
|
| 4 |
+
"description": "merge() utility function",
|
| 5 |
+
"keywords": [
|
| 6 |
+
"util"
|
| 7 |
+
],
|
| 8 |
+
"repository": {
|
| 9 |
+
"type": "git",
|
| 10 |
+
"url": "git://github.com/jaredhanson/utils-merge.git"
|
| 11 |
+
},
|
| 12 |
+
"bugs": {
|
| 13 |
+
"url": "http://github.com/jaredhanson/utils-merge/issues"
|
| 14 |
+
},
|
| 15 |
+
"author": {
|
| 16 |
+
"name": "Jared Hanson",
|
| 17 |
+
"email": "jaredhanson@gmail.com",
|
| 18 |
+
"url": "http://www.jaredhanson.net/"
|
| 19 |
+
},
|
| 20 |
+
"licenses": [
|
| 21 |
+
{
|
| 22 |
+
"type": "MIT",
|
| 23 |
+
"url": "http://www.opensource.org/licenses/MIT"
|
| 24 |
+
}
|
| 25 |
+
],
|
| 26 |
+
"main": "./index",
|
| 27 |
+
"dependencies": {},
|
| 28 |
+
"devDependencies": {
|
| 29 |
+
"mocha": "1.x.x",
|
| 30 |
+
"chai": "1.x.x"
|
| 31 |
+
},
|
| 32 |
+
"scripts": {
|
| 33 |
+
"test": "mocha --reporter spec --require test/bootstrap/node test/*.test.js"
|
| 34 |
+
},
|
| 35 |
+
"engines": {
|
| 36 |
+
"node": ">= 0.4.0"
|
| 37 |
+
},
|
| 38 |
+
"_id": "utils-merge@1.0.0",
|
| 39 |
+
"dist": {
|
| 40 |
+
"shasum": "0294fb922bb9375153541c4f7096231f287c8af8",
|
| 41 |
+
"tarball": "http://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz"
|
| 42 |
+
},
|
| 43 |
+
"_from": "utils-merge@1.0.0",
|
| 44 |
+
"_npmVersion": "1.2.25",
|
| 45 |
+
"_npmUser": {
|
| 46 |
+
"name": "jaredhanson",
|
| 47 |
+
"email": "jaredhanson@gmail.com"
|
| 48 |
+
},
|
| 49 |
+
"maintainers": [
|
| 50 |
+
{
|
| 51 |
+
"name": "jaredhanson",
|
| 52 |
+
"email": "jaredhanson@gmail.com"
|
| 53 |
+
}
|
| 54 |
+
],
|
| 55 |
+
"directories": {},
|
| 56 |
+
"_shasum": "0294fb922bb9375153541c4f7096231f287c8af8",
|
| 57 |
+
"_resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz",
|
| 58 |
+
"readme": "ERROR: No README data found!",
|
| 59 |
+
"homepage": "https://github.com/jaredhanson/utils-merge#readme"
|
| 60 |
+
}
|
5485-master/demos/node_modules/express/node_modules/vary/.npmignore
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
coverage/
|
| 2 |
+
test/
|
| 3 |
+
.travis.yml
|
5485-master/demos/node_modules/express/node_modules/vary/History.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
1.0.0 / 2014-08-10
|
| 2 |
+
==================
|
| 3 |
+
|
| 4 |
+
* Accept valid `Vary` header string as `field`
|
| 5 |
+
* Add `vary.append` for low-level string manipulation
|
| 6 |
+
* Move to `jshttp` orgainzation
|
| 7 |
+
|
| 8 |
+
0.1.0 / 2014-06-05
|
| 9 |
+
==================
|
| 10 |
+
|
| 11 |
+
* Support array of fields to set
|
| 12 |
+
|
| 13 |
+
0.0.0 / 2014-06-04
|
| 14 |
+
==================
|
| 15 |
+
|
| 16 |
+
* Initial release
|
5485-master/demos/node_modules/express/node_modules/vary/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014 Douglas Christopher Wilson
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 6 |
+
a copy of this software and associated documentation files (the
|
| 7 |
+
'Software'), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 10 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 11 |
+
the following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be
|
| 14 |
+
included in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 17 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
5485-master/demos/node_modules/express/node_modules/vary/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# vary
|
| 2 |
+
|
| 3 |
+
[](https://www.npmjs.org/package/vary)
|
| 4 |
+
[](http://nodejs.org/download/)
|
| 5 |
+
[](https://travis-ci.org/jshttp/vary)
|
| 6 |
+
[](https://coveralls.io/r/jshttp/vary)
|
| 7 |
+
[](https://www.gittip.com/dougwilson/)
|
| 8 |
+
|
| 9 |
+
Manipulate the HTTP Vary header
|
| 10 |
+
|
| 11 |
+
## Install
|
| 12 |
+
|
| 13 |
+
```sh
|
| 14 |
+
$ npm install vary
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## API
|
| 18 |
+
|
| 19 |
+
```js
|
| 20 |
+
var vary = require('vary')
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
### vary(res, field)
|
| 24 |
+
|
| 25 |
+
Adds the given header `field` to the `Vary` response header of `res`.
|
| 26 |
+
This can be a string of a single field, a string of a valid `Vary`
|
| 27 |
+
header, or an array of multiple fields.
|
| 28 |
+
|
| 29 |
+
This will append the header if not already listed, otherwise leaves
|
| 30 |
+
it listed in the current location.
|
| 31 |
+
|
| 32 |
+
```js
|
| 33 |
+
// Append "Origin" to the Vary header of the response
|
| 34 |
+
vary(res, 'Origin')
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
### vary.append(header, field)
|
| 38 |
+
|
| 39 |
+
Adds the given header `field` to the `Vary` response header string `header`.
|
| 40 |
+
This can be a string of a single field, a string of a valid `Vary` header,
|
| 41 |
+
or an array of multiple fields.
|
| 42 |
+
|
| 43 |
+
This will append the header if not already listed, otherwise leaves
|
| 44 |
+
it listed in the current location. The new header string is returned.
|
| 45 |
+
|
| 46 |
+
```js
|
| 47 |
+
// Get header string appending "Origin" to "Accept, User-Agent"
|
| 48 |
+
vary.append('Accept, User-Agent', 'Origin')
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## Testing
|
| 52 |
+
|
| 53 |
+
```sh
|
| 54 |
+
$ npm test
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## License
|
| 58 |
+
|
| 59 |
+
[MIT](LICENSE)
|
5485-master/demos/node_modules/express/node_modules/vary/index.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*!
|
| 2 |
+
* vary
|
| 3 |
+
* Copyright(c) 2014 Douglas Christopher Wilson
|
| 4 |
+
* MIT Licensed
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
/**
|
| 8 |
+
* Module exports.
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
module.exports = vary;
|
| 12 |
+
module.exports.append = append;
|
| 13 |
+
|
| 14 |
+
/**
|
| 15 |
+
* Variables.
|
| 16 |
+
*/
|
| 17 |
+
|
| 18 |
+
var separators = /[\(\)<>@,;:\\"\/\[\]\?=\{\}\u0020\u0009]/;
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Append a field to a vary header.
|
| 22 |
+
*
|
| 23 |
+
* @param {String} header
|
| 24 |
+
* @param {String|Array} field
|
| 25 |
+
* @return {String}
|
| 26 |
+
* @api public
|
| 27 |
+
*/
|
| 28 |
+
|
| 29 |
+
function append(header, field) {
|
| 30 |
+
if (typeof header !== 'string') {
|
| 31 |
+
throw new TypeError('header argument is required');
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
if (!field) {
|
| 35 |
+
throw new TypeError('field argument is required');
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
// get fields array
|
| 39 |
+
var fields = !Array.isArray(field)
|
| 40 |
+
? parse(String(field))
|
| 41 |
+
: field;
|
| 42 |
+
|
| 43 |
+
// assert on invalid fields
|
| 44 |
+
for (var i = 0; i < fields.length; i++) {
|
| 45 |
+
if (separators.test(fields[i])) {
|
| 46 |
+
throw new TypeError('field argument contains an invalid header');
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
// existing, unspecified vary
|
| 51 |
+
if (header === '*') {
|
| 52 |
+
return header;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
// enumerate current values
|
| 56 |
+
var vals = parse(header.toLowerCase());
|
| 57 |
+
|
| 58 |
+
// unspecified vary
|
| 59 |
+
if (fields.indexOf('*') !== -1 || vals.indexOf('*') !== -1) {
|
| 60 |
+
return '*';
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
for (var i = 0; i < fields.length; i++) {
|
| 64 |
+
field = fields[i].toLowerCase();
|
| 65 |
+
|
| 66 |
+
// append value (case-preserving)
|
| 67 |
+
if (vals.indexOf(field) === -1) {
|
| 68 |
+
vals.push(field);
|
| 69 |
+
header = header
|
| 70 |
+
? header + ', ' + fields[i]
|
| 71 |
+
: fields[i];
|
| 72 |
+
}
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
return header;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/**
|
| 79 |
+
* Parse a vary header into an array.
|
| 80 |
+
*
|
| 81 |
+
* @param {String} header
|
| 82 |
+
* @return {Array}
|
| 83 |
+
* @api private
|
| 84 |
+
*/
|
| 85 |
+
|
| 86 |
+
function parse(header) {
|
| 87 |
+
return header.trim().split(/ *, */);
|
| 88 |
+
}
|
| 89 |
+
|
| 90 |
+
/**
|
| 91 |
+
* Mark that a request is varied on a header field.
|
| 92 |
+
*
|
| 93 |
+
* @param {Object} res
|
| 94 |
+
* @param {String|Array} field
|
| 95 |
+
* @api public
|
| 96 |
+
*/
|
| 97 |
+
|
| 98 |
+
function vary(res, field) {
|
| 99 |
+
if (!res || !res.getHeader || !res.setHeader) {
|
| 100 |
+
// quack quack
|
| 101 |
+
throw new TypeError('res argument is required');
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
// get existing header
|
| 105 |
+
var val = res.getHeader('Vary') || ''
|
| 106 |
+
var header = Array.isArray(val)
|
| 107 |
+
? val.join(', ')
|
| 108 |
+
: String(val);
|
| 109 |
+
|
| 110 |
+
// set new header
|
| 111 |
+
res.setHeader('Vary', append(header, field));
|
| 112 |
+
}
|
5485-master/demos/node_modules/express/node_modules/vary/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "vary",
|
| 3 |
+
"description": "Manipulate the HTTP Vary header",
|
| 4 |
+
"version": "1.0.0",
|
| 5 |
+
"author": {
|
| 6 |
+
"name": "Douglas Christopher Wilson",
|
| 7 |
+
"email": "doug@somethingdoug.com"
|
| 8 |
+
},
|
| 9 |
+
"license": "MIT",
|
| 10 |
+
"keywords": [
|
| 11 |
+
"http",
|
| 12 |
+
"res",
|
| 13 |
+
"vary"
|
| 14 |
+
],
|
| 15 |
+
"repository": {
|
| 16 |
+
"type": "git",
|
| 17 |
+
"url": "git+https://github.com/jshttp/vary.git"
|
| 18 |
+
},
|
| 19 |
+
"devDependencies": {
|
| 20 |
+
"istanbul": "0.3.0",
|
| 21 |
+
"mocha": "~1.21.4",
|
| 22 |
+
"should": "~4.0.4",
|
| 23 |
+
"supertest": "~0.13.0"
|
| 24 |
+
},
|
| 25 |
+
"engines": {
|
| 26 |
+
"node": ">= 0.8.0"
|
| 27 |
+
},
|
| 28 |
+
"scripts": {
|
| 29 |
+
"test": "mocha --reporter spec --bail --check-leaks test/",
|
| 30 |
+
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
| 31 |
+
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
| 32 |
+
},
|
| 33 |
+
"gitHead": "56acecd9fa20888132563b00576625ea02a69a35",
|
| 34 |
+
"bugs": {
|
| 35 |
+
"url": "https://github.com/jshttp/vary/issues"
|
| 36 |
+
},
|
| 37 |
+
"homepage": "https://github.com/jshttp/vary",
|
| 38 |
+
"_id": "vary@1.0.0",
|
| 39 |
+
"_shasum": "c5e76cec20d3820d8f2a96e7bee38731c34da1e7",
|
| 40 |
+
"_from": "vary@>=1.0.0 <1.1.0",
|
| 41 |
+
"_npmVersion": "1.4.21",
|
| 42 |
+
"_npmUser": {
|
| 43 |
+
"name": "dougwilson",
|
| 44 |
+
"email": "doug@somethingdoug.com"
|
| 45 |
+
},
|
| 46 |
+
"maintainers": [
|
| 47 |
+
{
|
| 48 |
+
"name": "dougwilson",
|
| 49 |
+
"email": "doug@somethingdoug.com"
|
| 50 |
+
},
|
| 51 |
+
{
|
| 52 |
+
"name": "jongleberry",
|
| 53 |
+
"email": "jonathanrichardong@gmail.com"
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"name": "fishrock123",
|
| 57 |
+
"email": "fishrock123@rocketmail.com"
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"name": "shtylman",
|
| 61 |
+
"email": "shtylman@gmail.com"
|
| 62 |
+
}
|
| 63 |
+
],
|
| 64 |
+
"dist": {
|
| 65 |
+
"shasum": "c5e76cec20d3820d8f2a96e7bee38731c34da1e7",
|
| 66 |
+
"tarball": "http://registry.npmjs.org/vary/-/vary-1.0.0.tgz"
|
| 67 |
+
},
|
| 68 |
+
"directories": {},
|
| 69 |
+
"_resolved": "https://registry.npmjs.org/vary/-/vary-1.0.0.tgz",
|
| 70 |
+
"readme": "ERROR: No README data found!"
|
| 71 |
+
}
|
5485-master/demos/node_modules/method-override/HISTORY.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
2.3.3 / 2015-05-12
|
| 2 |
+
==================
|
| 3 |
+
|
| 4 |
+
* deps: debug@~2.2.0
|
| 5 |
+
- deps: ms@0.7.1
|
| 6 |
+
|
| 7 |
+
2.3.2 / 2015-03-14
|
| 8 |
+
==================
|
| 9 |
+
|
| 10 |
+
* deps: debug@~2.1.3
|
| 11 |
+
- Fix high intensity foreground color for bold
|
| 12 |
+
- deps: ms@0.7.0
|
| 13 |
+
|
| 14 |
+
2.3.1 / 2014-12-30
|
| 15 |
+
==================
|
| 16 |
+
|
| 17 |
+
* deps: debug@~2.1.1
|
| 18 |
+
* deps: methods@~1.1.1
|
| 19 |
+
|
| 20 |
+
2.3.0 / 2014-10-16
|
| 21 |
+
==================
|
| 22 |
+
|
| 23 |
+
* deps: debug@~2.1.0
|
| 24 |
+
- Implement `DEBUG_FD` env variable support
|
| 25 |
+
|
| 26 |
+
2.2.0 / 2014-09-02
|
| 27 |
+
==================
|
| 28 |
+
|
| 29 |
+
* deps: debug@~2.0.0
|
| 30 |
+
|
| 31 |
+
2.1.3 / 2014-08-10
|
| 32 |
+
==================
|
| 33 |
+
|
| 34 |
+
* deps: parseurl@~1.3.0
|
| 35 |
+
* deps: vary@~1.0.0
|
| 36 |
+
|
| 37 |
+
2.1.2 / 2014-07-22
|
| 38 |
+
==================
|
| 39 |
+
|
| 40 |
+
* deps: debug@1.0.4
|
| 41 |
+
* deps: parseurl@~1.2.0
|
| 42 |
+
- Cache URLs based on original value
|
| 43 |
+
- Remove no-longer-needed URL mis-parse work-around
|
| 44 |
+
- Simplify the "fast-path" `RegExp`
|
| 45 |
+
|
| 46 |
+
2.1.1 / 2014-07-11
|
| 47 |
+
==================
|
| 48 |
+
|
| 49 |
+
* deps: debug@1.0.3
|
| 50 |
+
- Add support for multiple wildcards in namespaces
|
| 51 |
+
|
| 52 |
+
2.1.0 / 2014-07-08
|
| 53 |
+
==================
|
| 54 |
+
|
| 55 |
+
* add simple debug output
|
| 56 |
+
* deps: methods@1.1.0
|
| 57 |
+
- add `CONNECT`
|
| 58 |
+
* deps: parseurl@~1.1.3
|
| 59 |
+
- faster parsing of href-only URLs
|
| 60 |
+
|
| 61 |
+
2.0.2 / 2014-06-05
|
| 62 |
+
==================
|
| 63 |
+
|
| 64 |
+
* use vary module for better `Vary` behavior
|
| 65 |
+
|
| 66 |
+
2.0.1 / 2014-06-02
|
| 67 |
+
==================
|
| 68 |
+
|
| 69 |
+
* deps: methods@1.0.1
|
| 70 |
+
|
| 71 |
+
2.0.0 / 2014-06-01
|
| 72 |
+
==================
|
| 73 |
+
|
| 74 |
+
* Default behavior only checks `X-HTTP-Method-Override` header
|
| 75 |
+
* New interface, less magic
|
| 76 |
+
- Can specify what header to look for override in, if wanted
|
| 77 |
+
- Can specify custom function to get method from request
|
| 78 |
+
* Only `POST` requests are examined by default
|
| 79 |
+
* Remove `req.body` support for more standard query param support
|
| 80 |
+
- Use custom `getter` function if `req.body` support is needed
|
| 81 |
+
* Set `Vary` header when using built-in header checking
|
| 82 |
+
|
| 83 |
+
1.0.2 / 2014-05-22
|
| 84 |
+
==================
|
| 85 |
+
|
| 86 |
+
* Handle `req.body` key referencing array or object
|
| 87 |
+
* Handle multiple HTTP headers
|
| 88 |
+
|
| 89 |
+
1.0.1 / 2014-05-17
|
| 90 |
+
==================
|
| 91 |
+
|
| 92 |
+
* deps: pin dependency versions
|
| 93 |
+
|
| 94 |
+
1.0.0 / 2014-03-03
|
| 95 |
+
==================
|
| 96 |
+
|
| 97 |
+
* Genesis from `connect`
|
5485-master/demos/node_modules/method-override/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(The MIT License)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
| 4 |
+
Copyright (c) 2014 Douglas Christopher Wilson <doug@somethingdoug.com>
|
| 5 |
+
|
| 6 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 7 |
+
a copy of this software and associated documentation files (the
|
| 8 |
+
'Software'), to deal in the Software without restriction, including
|
| 9 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 10 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 11 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 12 |
+
the following conditions:
|
| 13 |
+
|
| 14 |
+
The above copyright notice and this permission notice shall be
|
| 15 |
+
included in all copies or substantial portions of the Software.
|
| 16 |
+
|
| 17 |
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
| 18 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 19 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 20 |
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 21 |
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 22 |
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 23 |
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
5485-master/demos/node_modules/method-override/README.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# method-override
|
| 2 |
+
|
| 3 |
+
[![NPM Version][npm-image]][npm-url]
|
| 4 |
+
[![NPM Downloads][downloads-image]][downloads-url]
|
| 5 |
+
[![Build Status][travis-image]][travis-url]
|
| 6 |
+
[![Test Coverage][coveralls-image]][coveralls-url]
|
| 7 |
+
[![Gratipay][gratipay-image]][gratipay-url]
|
| 8 |
+
|
| 9 |
+
Lets you use HTTP verbs such as PUT or DELETE in places where the client doesn't support it.
|
| 10 |
+
|
| 11 |
+
## Install
|
| 12 |
+
|
| 13 |
+
```sh
|
| 14 |
+
$ npm install method-override
|
| 15 |
+
```
|
| 16 |
+
|
| 17 |
+
## API
|
| 18 |
+
|
| 19 |
+
**NOTE** It is very important that this module is used **before** any module that
|
| 20 |
+
needs to know the method of the request (for example, it _must_ be used prior to
|
| 21 |
+
the `csurf` module).
|
| 22 |
+
|
| 23 |
+
### methodOverride(getter, options)
|
| 24 |
+
|
| 25 |
+
Create a new middleware function to override the `req.method` property with a new
|
| 26 |
+
value. This value will be pulled from the provided `getter`.
|
| 27 |
+
|
| 28 |
+
- `getter` - The getter to use to look up the overridden request method for the request. (default: `X-HTTP-Method-Override`)
|
| 29 |
+
- `options.methods` - The allowed methods the original request must be in to check for a method override value. (default: `['POST']`)
|
| 30 |
+
|
| 31 |
+
If the found method is supported by node.js core, then `req.method` will be set to
|
| 32 |
+
this value, as if it has originally been that value. The previous `req.method`
|
| 33 |
+
value will be stored in `req.originalMethod`.
|
| 34 |
+
|
| 35 |
+
#### getter
|
| 36 |
+
|
| 37 |
+
This is the method of getting the override value from the request. If a function is provided,
|
| 38 |
+
the `req` is passed as the first argument, the `res` as the second argument and the method is
|
| 39 |
+
expected to be returned. If a string is provided, the string is used to look up the method
|
| 40 |
+
with the following rules:
|
| 41 |
+
|
| 42 |
+
- If the string starts with `X-`, then it is treated as the name of a header and that header
|
| 43 |
+
is used for the method override. If the request contains the same header multiple times, the
|
| 44 |
+
first occurrence is used.
|
| 45 |
+
- All other strings are treated as a key in the URL query string.
|
| 46 |
+
|
| 47 |
+
#### options.methods
|
| 48 |
+
|
| 49 |
+
This allows the specification of what methods(s) the request *MUST* be in in order to check for
|
| 50 |
+
the method override value. This defaults to only `POST` methods, which is the only method the
|
| 51 |
+
override should arrive in. More methods may be specified here, but it may introduce security
|
| 52 |
+
issues and cause weird behavior when requests travel through caches. This value is an array
|
| 53 |
+
of methods in upper-case. `null` can be specified to allow all methods.
|
| 54 |
+
|
| 55 |
+
## Examples
|
| 56 |
+
|
| 57 |
+
### override using a header
|
| 58 |
+
|
| 59 |
+
To use a header to override the method, specify the header name
|
| 60 |
+
as a string argument to the `methodOverride` function. To then make
|
| 61 |
+
the call, send a `POST` request to a URL with the overridden method
|
| 62 |
+
as the value of that header. This method of using a header would
|
| 63 |
+
typically be used in conjunction with `XMLHttpRequest` on implementations
|
| 64 |
+
that do not support the method you are trying to use.
|
| 65 |
+
|
| 66 |
+
```js
|
| 67 |
+
var connect = require('connect')
|
| 68 |
+
var methodOverride = require('method-override')
|
| 69 |
+
|
| 70 |
+
// override with the X-HTTP-Method-Override header in the request
|
| 71 |
+
app.use(methodOverride('X-HTTP-Method-Override'))
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
Example call with header override using `XMLHttpRequest`:
|
| 75 |
+
|
| 76 |
+
```js
|
| 77 |
+
var xhr = new XMLHttpRequest()
|
| 78 |
+
xhr.onload = onload
|
| 79 |
+
xhr.open('post', '/resource', true)
|
| 80 |
+
xhr.setRequestHeader('X-HTTP-Method-Override', 'DELETE')
|
| 81 |
+
xhr.send()
|
| 82 |
+
|
| 83 |
+
function onload() {
|
| 84 |
+
alert('got response: ' + this.responseText)
|
| 85 |
+
}
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
### override using a query value
|
| 89 |
+
|
| 90 |
+
To use a query string value to override the method, specify the query
|
| 91 |
+
string key as a string argument to the `methodOverride` function. To
|
| 92 |
+
then make the call, send a `POST` request to a URL with the overridden
|
| 93 |
+
method as the value of that query string key. This method of using a
|
| 94 |
+
query value would typically be used in conjunction with plain HTML
|
| 95 |
+
`<form>` elements when trying to support legacy browsers but still use
|
| 96 |
+
newer methods.
|
| 97 |
+
|
| 98 |
+
```js
|
| 99 |
+
var connect = require('connect')
|
| 100 |
+
var methodOverride = require('method-override')
|
| 101 |
+
|
| 102 |
+
// override with POST having ?_method=DELETE
|
| 103 |
+
app.use(methodOverride('_method'))
|
| 104 |
+
```
|
| 105 |
+
|
| 106 |
+
Example call with query override using HTML `<form>`:
|
| 107 |
+
|
| 108 |
+
```html
|
| 109 |
+
<form method="POST" action="/resource?_method=DELETE">
|
| 110 |
+
<button type="submit">Delete resource</button>
|
| 111 |
+
</form>
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
### multiple format support
|
| 115 |
+
|
| 116 |
+
```js
|
| 117 |
+
var connect = require('connect')
|
| 118 |
+
var methodOverride = require('method-override')
|
| 119 |
+
|
| 120 |
+
// override with different headers; last one takes precedence
|
| 121 |
+
app.use(methodOverride('X-HTTP-Method')) // Microsoft
|
| 122 |
+
app.use(methodOverride('X-HTTP-Method-Override')) // Google/GData
|
| 123 |
+
app.use(methodOverride('X-Method-Override')) // IBM
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
### custom logic
|
| 127 |
+
|
| 128 |
+
You can implement any kind of custom logic with a function for the `getter`. The following
|
| 129 |
+
implements the logic for looking in `req.body` that was in `method-override@1`:
|
| 130 |
+
|
| 131 |
+
```js
|
| 132 |
+
var bodyParser = require('body-parser')
|
| 133 |
+
var connect = require('connect')
|
| 134 |
+
var methodOverride = require('method-override')
|
| 135 |
+
|
| 136 |
+
// NOTE: when using req.body, you must fully parse the request body
|
| 137 |
+
// before you call methodOverride() in your middleware stack,
|
| 138 |
+
// otherwise req.body will not be populated.
|
| 139 |
+
app.use(bodyParser.urlencoded())
|
| 140 |
+
app.use(methodOverride(function(req, res){
|
| 141 |
+
if (req.body && typeof req.body === 'object' && '_method' in req.body) {
|
| 142 |
+
// look in urlencoded POST bodies and delete it
|
| 143 |
+
var method = req.body._method
|
| 144 |
+
delete req.body._method
|
| 145 |
+
return method
|
| 146 |
+
}
|
| 147 |
+
}))
|
| 148 |
+
```
|
| 149 |
+
|
| 150 |
+
Example call with query override using HTML `<form>`:
|
| 151 |
+
|
| 152 |
+
```html
|
| 153 |
+
<!-- enctype must be set to the type you will parse before methodOverride() -->
|
| 154 |
+
<form method="POST" action="/resource" enctype="application/x-www-form-urlencoded">
|
| 155 |
+
<input type="hidden" name="_method" value="DELETE">
|
| 156 |
+
<button type="submit">Delete resource</button>
|
| 157 |
+
</form>
|
| 158 |
+
```
|
| 159 |
+
|
| 160 |
+
## License
|
| 161 |
+
|
| 162 |
+
[MIT](LICENSE)
|
| 163 |
+
|
| 164 |
+
[npm-image]: https://img.shields.io/npm/v/method-override.svg
|
| 165 |
+
[npm-url]: https://npmjs.org/package/method-override
|
| 166 |
+
[travis-image]: https://img.shields.io/travis/expressjs/method-override/master.svg
|
| 167 |
+
[travis-url]: https://travis-ci.org/expressjs/method-override
|
| 168 |
+
[coveralls-image]: https://img.shields.io/coveralls/expressjs/method-override/master.svg
|
| 169 |
+
[coveralls-url]: https://coveralls.io/r/expressjs/method-override?branch=master
|
| 170 |
+
[downloads-image]: https://img.shields.io/npm/dm/method-override.svg
|
| 171 |
+
[downloads-url]: https://npmjs.org/package/method-override
|
| 172 |
+
[gratipay-image]: https://img.shields.io/gratipay/dougwilson.svg
|
| 173 |
+
[gratipay-url]: https://www.gratipay.com/dougwilson/
|