mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-13 11:12:47 +00:00
Added all files
This commit is contained in:
76
node_modules/express/node_modules/finalhandler/HISTORY.md
generated
vendored
Normal file
76
node_modules/express/node_modules/finalhandler/HISTORY.md
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
0.3.6 / 2015-05-11
|
||||
==================
|
||||
|
||||
* deps: debug@~2.2.0
|
||||
- deps: ms@0.7.1
|
||||
|
||||
0.3.5 / 2015-04-22
|
||||
==================
|
||||
|
||||
* deps: on-finished@~2.2.1
|
||||
- Fix `isFinished(req)` when data buffered
|
||||
|
||||
0.3.4 / 2015-03-15
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.3
|
||||
- Fix high intensity foreground color for bold
|
||||
- deps: ms@0.7.0
|
||||
|
||||
0.3.3 / 2015-01-01
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.1
|
||||
* deps: on-finished@~2.2.0
|
||||
|
||||
0.3.2 / 2014-10-22
|
||||
==================
|
||||
|
||||
* deps: on-finished@~2.1.1
|
||||
- Fix handling of pipelined requests
|
||||
|
||||
0.3.1 / 2014-10-16
|
||||
==================
|
||||
|
||||
* deps: debug@~2.1.0
|
||||
- Implement `DEBUG_FD` env variable support
|
||||
|
||||
0.3.0 / 2014-09-17
|
||||
==================
|
||||
|
||||
* Terminate in progress response only on error
|
||||
* Use `on-finished` to determine request status
|
||||
|
||||
0.2.0 / 2014-09-03
|
||||
==================
|
||||
|
||||
* Set `X-Content-Type-Options: nosniff` header
|
||||
* deps: debug@~2.0.0
|
||||
|
||||
0.1.0 / 2014-07-16
|
||||
==================
|
||||
|
||||
* Respond after request fully read
|
||||
- prevents hung responses and socket hang ups
|
||||
* deps: debug@1.0.4
|
||||
|
||||
0.0.3 / 2014-07-11
|
||||
==================
|
||||
|
||||
* deps: debug@1.0.3
|
||||
- Add support for multiple wildcards in namespaces
|
||||
|
||||
0.0.2 / 2014-06-19
|
||||
==================
|
||||
|
||||
* Handle invalid status codes
|
||||
|
||||
0.0.1 / 2014-06-05
|
||||
==================
|
||||
|
||||
* deps: debug@1.0.2
|
||||
|
||||
0.0.0 / 2014-06-05
|
||||
==================
|
||||
|
||||
* Extracted from connect/express
|
||||
22
node_modules/express/node_modules/finalhandler/LICENSE
generated
vendored
Normal file
22
node_modules/express/node_modules/finalhandler/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
133
node_modules/express/node_modules/finalhandler/README.md
generated
vendored
Normal file
133
node_modules/express/node_modules/finalhandler/README.md
generated
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
# finalhandler
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-image]][node-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Node.js function to invoke as the final step to respond to HTTP request.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install finalhandler
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
```
|
||||
|
||||
### finalhandler(req, res, [options])
|
||||
|
||||
Returns function to be invoked as the final step for the given `req` and `res`.
|
||||
This function is to be invoked as `fn(err)`. If `err` is falsy, the handler will
|
||||
write out a 404 response to the `res`. If it is truthy, an error response will
|
||||
be written out to the `res`, and `res.statusCode` is set from `err.status`.
|
||||
|
||||
The final handler will also unpipe anything from `req` when it is invoked.
|
||||
|
||||
#### options.env
|
||||
|
||||
By default, the environment is determined by `NODE_ENV` variable, but it can be
|
||||
overridden by this option.
|
||||
|
||||
#### options.onerror
|
||||
|
||||
Provide a function to be called with the `err` when it exists. Can be used for
|
||||
writing errors to a central location without excessive function generation. Called
|
||||
as `onerror(err, req, res)`.
|
||||
|
||||
## Examples
|
||||
|
||||
### always 404
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
var http = require('http')
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var done = finalhandler(req, res)
|
||||
done()
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### perform simple action
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
var fs = require('fs')
|
||||
var http = require('http')
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var done = finalhandler(req, res)
|
||||
|
||||
fs.readFile('index.html', function (err, buf) {
|
||||
if (err) return done(err)
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.end(buf)
|
||||
})
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### use with middleware-style functions
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
var http = require('http')
|
||||
var serveStatic = require('serve-static')
|
||||
|
||||
var serve = serveStatic('public')
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var done = finalhandler(req, res)
|
||||
serve(req, res, done)
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
### keep log of all errors
|
||||
|
||||
```js
|
||||
var finalhandler = require('finalhandler')
|
||||
var fs = require('fs')
|
||||
var http = require('http')
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
var done = finalhandler(req, res, {onerror: logerror})
|
||||
|
||||
fs.readFile('index.html', function (err, buf) {
|
||||
if (err) return done(err)
|
||||
res.setHeader('Content-Type', 'text/html')
|
||||
res.end(buf)
|
||||
})
|
||||
})
|
||||
|
||||
server.listen(3000)
|
||||
|
||||
function logerror(err) {
|
||||
console.error(err.stack || err.toString())
|
||||
}
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/finalhandler.svg
|
||||
[npm-url]: https://npmjs.org/package/finalhandler
|
||||
[node-image]: https://img.shields.io/node/v/finalhandler.svg
|
||||
[node-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/pillarjs/finalhandler.svg
|
||||
[travis-url]: https://travis-ci.org/pillarjs/finalhandler
|
||||
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/finalhandler.svg
|
||||
[coveralls-url]: https://coveralls.io/r/pillarjs/finalhandler?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/finalhandler.svg
|
||||
[downloads-url]: https://npmjs.org/package/finalhandler
|
||||
171
node_modules/express/node_modules/finalhandler/index.js
generated
vendored
Normal file
171
node_modules/express/node_modules/finalhandler/index.js
generated
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
/*!
|
||||
* finalhandler
|
||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var debug = require('debug')('finalhandler')
|
||||
var escapeHtml = require('escape-html')
|
||||
var http = require('http')
|
||||
var onFinished = require('on-finished')
|
||||
|
||||
/**
|
||||
* Variables.
|
||||
*/
|
||||
|
||||
/* istanbul ignore next */
|
||||
var defer = typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
var isFinished = onFinished.isFinished
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = finalhandler
|
||||
|
||||
/**
|
||||
* Final handler:
|
||||
*
|
||||
* @param {Request} req
|
||||
* @param {Response} res
|
||||
* @param {Object} [options]
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function finalhandler(req, res, options) {
|
||||
options = options || {}
|
||||
|
||||
// get environment
|
||||
var env = options.env || process.env.NODE_ENV || 'development'
|
||||
|
||||
// get error callback
|
||||
var onerror = options.onerror
|
||||
|
||||
return function (err) {
|
||||
var msg
|
||||
|
||||
// ignore 404 on in-flight response
|
||||
if (!err && res._header) {
|
||||
debug('cannot 404 after headers sent')
|
||||
return
|
||||
}
|
||||
|
||||
// unhandled error
|
||||
if (err) {
|
||||
// default status code to 500
|
||||
if (!res.statusCode || res.statusCode < 400) {
|
||||
res.statusCode = 500
|
||||
}
|
||||
|
||||
// respect err.status
|
||||
if (err.status) {
|
||||
res.statusCode = err.status
|
||||
}
|
||||
|
||||
// production gets a basic error message
|
||||
var msg = env === 'production'
|
||||
? http.STATUS_CODES[res.statusCode]
|
||||
: err.stack || err.toString()
|
||||
msg = escapeHtml(msg)
|
||||
.replace(/\n/g, '<br>')
|
||||
.replace(/ /g, ' ') + '\n'
|
||||
} else {
|
||||
res.statusCode = 404
|
||||
msg = 'Cannot ' + escapeHtml(req.method) + ' ' + escapeHtml(req.originalUrl || req.url) + '\n'
|
||||
}
|
||||
|
||||
debug('default %s', res.statusCode)
|
||||
|
||||
// schedule onerror callback
|
||||
if (err && onerror) {
|
||||
defer(onerror, err, req, res)
|
||||
}
|
||||
|
||||
// cannot actually respond
|
||||
if (res._header) {
|
||||
return req.socket.destroy()
|
||||
}
|
||||
|
||||
send(req, res, res.statusCode, msg)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send response.
|
||||
*
|
||||
* @param {IncomingMessage} req
|
||||
* @param {OutgoingMessage} res
|
||||
* @param {number} status
|
||||
* @param {string} body
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function send(req, res, status, body) {
|
||||
function write() {
|
||||
res.statusCode = status
|
||||
|
||||
// security header for content sniffing
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||
|
||||
// standard headers
|
||||
res.setHeader('Content-Type', 'text/html; charset=utf-8')
|
||||
res.setHeader('Content-Length', Buffer.byteLength(body, 'utf8'))
|
||||
|
||||
if (req.method === 'HEAD') {
|
||||
res.end()
|
||||
return
|
||||
}
|
||||
|
||||
res.end(body, 'utf8')
|
||||
}
|
||||
|
||||
if (isFinished(req)) {
|
||||
write()
|
||||
return
|
||||
}
|
||||
|
||||
// unpipe everything from the request
|
||||
unpipe(req)
|
||||
|
||||
// flush the request
|
||||
onFinished(req, write)
|
||||
req.resume()
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpipe everything from a stream.
|
||||
*
|
||||
* @param {Object} stream
|
||||
* @api private
|
||||
*/
|
||||
|
||||
/* istanbul ignore next: implementation differs between versions */
|
||||
function unpipe(stream) {
|
||||
if (typeof stream.unpipe === 'function') {
|
||||
// new-style
|
||||
stream.unpipe()
|
||||
return
|
||||
}
|
||||
|
||||
// Node.js 0.8 hack
|
||||
var listener
|
||||
var listeners = stream.listeners('close')
|
||||
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
listener = listeners[i]
|
||||
|
||||
if (listener.name !== 'cleanup' && listener.name !== 'onclose') {
|
||||
continue
|
||||
}
|
||||
|
||||
// invoke the listener
|
||||
listener.call(stream)
|
||||
}
|
||||
}
|
||||
80
node_modules/express/node_modules/finalhandler/package.json
generated
vendored
Normal file
80
node_modules/express/node_modules/finalhandler/package.json
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "finalhandler",
|
||||
"description": "Node.js final http responder",
|
||||
"version": "0.3.6",
|
||||
"author": {
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pillarjs/finalhandler.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"debug": "~2.2.0",
|
||||
"escape-html": "1.0.1",
|
||||
"on-finished": "~2.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "~2.2.4",
|
||||
"readable-stream": "~1.0.33",
|
||||
"supertest": "~0.15.0"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"HISTORY.md",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
},
|
||||
"gitHead": "10c8b938d00acdd5a2bdc6fbd912fb24ffd9f328",
|
||||
"bugs": {
|
||||
"url": "https://github.com/pillarjs/finalhandler/issues"
|
||||
},
|
||||
"homepage": "https://github.com/pillarjs/finalhandler",
|
||||
"_id": "finalhandler@0.3.6",
|
||||
"_shasum": "daf9c4161b1b06e001466b1411dfdb6973be138b",
|
||||
"_from": "finalhandler@0.3.6",
|
||||
"_npmVersion": "1.4.28",
|
||||
"_npmUser": {
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "fishrock123",
|
||||
"email": "fishrock123@rocketmail.com"
|
||||
},
|
||||
{
|
||||
"name": "defunctzombie",
|
||||
"email": "shtylman@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "daf9c4161b1b06e001466b1411dfdb6973be138b",
|
||||
"tarball": "http://registry.npmjs.org/finalhandler/-/finalhandler-0.3.6.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-0.3.6.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
Reference in New Issue
Block a user