mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-12 02:42:48 +00:00
updated bunch of file paths and changed the way posts are loaded
This commit is contained in:
30
node_modules/morgan/HISTORY.md
generated
vendored
30
node_modules/morgan/HISTORY.md
generated
vendored
@@ -1,3 +1,33 @@
|
||||
1.6.1 / 2015-07-03
|
||||
==================
|
||||
|
||||
* deps: basic-auth@~1.0.3
|
||||
|
||||
1.6.0 / 2015-06-12
|
||||
==================
|
||||
|
||||
* Add `morgan.compile(format)` export
|
||||
* Do not color 1xx status codes in `dev` format
|
||||
* Fix `response-time` token to not include response latency
|
||||
* Fix `status` token incorrectly displaying before response in `dev` format
|
||||
* Fix token return values to be `undefined` or a string
|
||||
* Improve representation of multiple headers in `req` and `res` tokens
|
||||
* Use `res.getHeader` in `res` token
|
||||
* deps: basic-auth@~1.0.2
|
||||
- perf: enable strict mode
|
||||
- perf: hoist regular expression
|
||||
- perf: parse with regular expressions
|
||||
- perf: remove argument reassignment
|
||||
* deps: on-finished@~2.3.0
|
||||
- Add defined behavior for HTTP `CONNECT` requests
|
||||
- Add defined behavior for HTTP `Upgrade` requests
|
||||
- deps: ee-first@1.1.1
|
||||
* pref: enable strict mode
|
||||
* pref: reduce function closure scopes
|
||||
* pref: remove dynamic compile on every request for `dev` format
|
||||
* pref: remove an argument reassignment
|
||||
* pref: skip function call without `skip` option
|
||||
|
||||
1.5.3 / 2015-05-10
|
||||
==================
|
||||
|
||||
|
||||
2
node_modules/morgan/LICENSE
generated
vendored
2
node_modules/morgan/LICENSE
generated
vendored
@@ -1,7 +1,7 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2014 Douglas Christopher Wilson <doug@somethingdoug.com>
|
||||
Copyright (c) 2014-2015 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
|
||||
|
||||
11
node_modules/morgan/README.md
generated
vendored
11
node_modules/morgan/README.md
generated
vendored
@@ -159,6 +159,17 @@ The URL of the request. This will use `req.originalUrl` if exists, otherwise `re
|
||||
|
||||
The contents of the User-Agent header of the request.
|
||||
|
||||
### morgan.compile(format)
|
||||
|
||||
Compile a format string into a function for use by `morgan`. A format string
|
||||
is a string that represents a single log line and can utilize token syntax.
|
||||
Tokens are references by `:token-name`. If tokens accept arguments, they can
|
||||
be passed using `[]`, for example: `:token-name[pretty]` would pass the string
|
||||
`'pretty'` as an argument to the token `token-name`.
|
||||
|
||||
Normally formats are defined using `morgan.format(name, format)`, but for certain
|
||||
advanced uses, this compile function is directly available.
|
||||
|
||||
## Examples
|
||||
|
||||
### express/connect
|
||||
|
||||
402
node_modules/morgan/index.js
generated
vendored
402
node_modules/morgan/index.js
generated
vendored
@@ -3,10 +3,22 @@
|
||||
* Copyright(c) 2010 Sencha Inc.
|
||||
* Copyright(c) 2011 TJ Holowaychuk
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
||||
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = morgan
|
||||
module.exports.compile = compile
|
||||
module.exports.format = format
|
||||
module.exports.token = token
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
* @private
|
||||
@@ -16,6 +28,7 @@ var auth = require('basic-auth')
|
||||
var debug = require('debug')('morgan')
|
||||
var deprecate = require('depd')('morgan')
|
||||
var onFinished = require('on-finished')
|
||||
var onHeaders = require('on-headers')
|
||||
|
||||
/**
|
||||
* Array of CLF month names.
|
||||
@@ -43,79 +56,70 @@ var defaultBufferDuration = 1000;
|
||||
* @return {Function} middleware
|
||||
*/
|
||||
|
||||
exports = module.exports = function morgan(format, options) {
|
||||
if (typeof format === 'object') {
|
||||
options = format
|
||||
format = options.format || 'default'
|
||||
function morgan(format, options) {
|
||||
var fmt = format
|
||||
var opts = options || {}
|
||||
|
||||
if (format && typeof format === 'object') {
|
||||
opts = format
|
||||
fmt = opts.format || 'default'
|
||||
|
||||
// smart deprecation message
|
||||
deprecate('morgan(options): use morgan(' + (typeof format === 'string' ? JSON.stringify(format) : 'format') + ', options) instead')
|
||||
deprecate('morgan(options): use morgan(' + (typeof fmt === 'string' ? JSON.stringify(fmt) : 'format') + ', options) instead')
|
||||
}
|
||||
|
||||
if (format === undefined) {
|
||||
if (fmt === undefined) {
|
||||
deprecate('undefined format: specify a format')
|
||||
}
|
||||
|
||||
options = options || {}
|
||||
|
||||
// output on request instead of response
|
||||
var immediate = options.immediate;
|
||||
var immediate = opts.immediate
|
||||
|
||||
// check if log entry should be skipped
|
||||
var skip = options.skip || function () { return false; };
|
||||
var skip = opts.skip || false
|
||||
|
||||
// format function
|
||||
var fmt = compile(exports[format] || format || exports.default)
|
||||
var formatLine = typeof fmt !== 'function'
|
||||
? getFormatFunction(fmt)
|
||||
: fmt
|
||||
|
||||
// steam
|
||||
var buffer = options.buffer
|
||||
var stream = options.stream || process.stdout
|
||||
// stream
|
||||
var buffer = opts.buffer
|
||||
var stream = opts.stream || process.stdout
|
||||
|
||||
// buffering support
|
||||
if (buffer) {
|
||||
deprecate('buffer option')
|
||||
|
||||
var realStream = stream
|
||||
var buf = []
|
||||
var timer = null
|
||||
var interval = 'number' == typeof buffer
|
||||
? buffer
|
||||
: defaultBufferDuration
|
||||
|
||||
// flush function
|
||||
var flush = function(){
|
||||
timer = null
|
||||
|
||||
if (buf.length) {
|
||||
realStream.write(buf.join(''));
|
||||
buf.length = 0;
|
||||
}
|
||||
}
|
||||
// flush interval
|
||||
var interval = typeof buffer !== 'number'
|
||||
? defaultBufferDuration
|
||||
: buffer
|
||||
|
||||
// swap the stream
|
||||
stream = {
|
||||
write: function(str){
|
||||
if (timer === null) {
|
||||
timer = setTimeout(flush, interval)
|
||||
}
|
||||
|
||||
buf.push(str);
|
||||
}
|
||||
};
|
||||
stream = createBufferStream(stream, interval)
|
||||
}
|
||||
|
||||
return function logger(req, res, next) {
|
||||
req._startAt = process.hrtime();
|
||||
req._startTime = new Date;
|
||||
req._remoteAddress = getip(req);
|
||||
// request data
|
||||
req._startAt = undefined
|
||||
req._startTime = undefined
|
||||
req._remoteAddress = getip(req)
|
||||
|
||||
function logRequest(){
|
||||
if (skip(req, res)) {
|
||||
// response data
|
||||
res._startAt = undefined
|
||||
res._startTime = undefined
|
||||
|
||||
// record request start
|
||||
recordStartTime.call(req)
|
||||
|
||||
function logRequest() {
|
||||
if (skip !== false && skip(req, res)) {
|
||||
debug('skip request')
|
||||
return
|
||||
}
|
||||
|
||||
var line = fmt(exports, req, res)
|
||||
var line = formatLine(morgan, req, res)
|
||||
|
||||
if (null == line) {
|
||||
debug('skip line')
|
||||
@@ -126,133 +130,94 @@ exports = module.exports = function morgan(format, options) {
|
||||
stream.write(line + '\n')
|
||||
};
|
||||
|
||||
// immediate
|
||||
if (immediate) {
|
||||
logRequest();
|
||||
// immediate log
|
||||
logRequest()
|
||||
} else {
|
||||
// record response start
|
||||
onHeaders(res, recordStartTime)
|
||||
|
||||
// log when response finished
|
||||
onFinished(res, logRequest)
|
||||
}
|
||||
|
||||
next();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Compile `format` into a function.
|
||||
*
|
||||
* @private
|
||||
* @param {Function|String} format
|
||||
* @return {Function}
|
||||
*/
|
||||
|
||||
function compile(format) {
|
||||
if (typeof format === 'function') {
|
||||
// already compiled
|
||||
return format
|
||||
}
|
||||
|
||||
if (typeof format !== 'string') {
|
||||
throw new TypeError('argument format must be a function or string')
|
||||
}
|
||||
|
||||
var fmt = format.replace(/"/g, '\\"')
|
||||
var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){
|
||||
return '"\n + (tokens["' + name + '"](req, res, ' + String(JSON.stringify(arg)) + ') || "-") + "';
|
||||
}) + '";'
|
||||
|
||||
return new Function('tokens, req, res', js);
|
||||
};
|
||||
|
||||
/**
|
||||
* Define a token function with the given `name`,
|
||||
* and callback `fn(req, res)`.
|
||||
*
|
||||
* @public
|
||||
* @param {String} name
|
||||
* @param {Function} fn
|
||||
* @return {Object} exports for chaining
|
||||
*/
|
||||
|
||||
exports.token = function(name, fn) {
|
||||
exports[name] = fn;
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Define a `fmt` with the given `name`.
|
||||
*
|
||||
* @public
|
||||
* @param {String} name
|
||||
* @param {String|Function} fmt
|
||||
* @return {Object} exports for chaining
|
||||
*/
|
||||
|
||||
exports.format = function(name, fmt){
|
||||
exports[name] = fmt;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Apache combined log format.
|
||||
*/
|
||||
|
||||
exports.format('combined', ':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"')
|
||||
morgan.format('combined', ':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"')
|
||||
|
||||
/**
|
||||
* Apache common log format.
|
||||
*/
|
||||
|
||||
exports.format('common', ':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length]')
|
||||
morgan.format('common', ':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length]')
|
||||
|
||||
/**
|
||||
* Default format.
|
||||
*/
|
||||
|
||||
exports.format('default', ':remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"');
|
||||
deprecate.property(exports, 'default', 'default format: use combined format')
|
||||
morgan.format('default', ':remote-addr - :remote-user [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"')
|
||||
deprecate.property(morgan, 'default', 'default format: use combined format')
|
||||
|
||||
/**
|
||||
* Short format.
|
||||
*/
|
||||
|
||||
exports.format('short', ':remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms');
|
||||
morgan.format('short', ':remote-addr :remote-user :method :url HTTP/:http-version :status :res[content-length] - :response-time ms')
|
||||
|
||||
/**
|
||||
* Tiny format.
|
||||
*/
|
||||
|
||||
exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms');
|
||||
morgan.format('tiny', ':method :url :status :res[content-length] - :response-time ms')
|
||||
|
||||
/**
|
||||
* dev (colored)
|
||||
*/
|
||||
|
||||
exports.format('dev', function(tokens, req, res){
|
||||
var color = 32; // green
|
||||
var status = res.statusCode;
|
||||
morgan.format('dev', function developmentFormatLine(tokens, req, res) {
|
||||
// get the status code if response written
|
||||
var status = res._header
|
||||
? res.statusCode
|
||||
: undefined
|
||||
|
||||
if (status >= 500) color = 31; // red
|
||||
else if (status >= 400) color = 33; // yellow
|
||||
else if (status >= 300) color = 36; // cyan
|
||||
// get status color
|
||||
var color = status >= 500 ? 31 // red
|
||||
: status >= 400 ? 33 // yellow
|
||||
: status >= 300 ? 36 // cyan
|
||||
: status >= 200 ? 32 // green
|
||||
: 0 // no color
|
||||
|
||||
var fn = compile('\x1b[0m:method :url \x1b[' + color + 'm:status \x1b[0m:response-time ms - :res[content-length]\x1b[0m');
|
||||
// get colored function
|
||||
var fn = developmentFormatLine[color]
|
||||
|
||||
return fn(tokens, req, res);
|
||||
});
|
||||
if (!fn) {
|
||||
// compile
|
||||
fn = developmentFormatLine[color] = compile('\x1b[0m:method :url \x1b['
|
||||
+ color + 'm:status \x1b[0m:response-time ms - :res[content-length]\x1b[0m')
|
||||
}
|
||||
|
||||
return fn(tokens, req, res)
|
||||
})
|
||||
|
||||
/**
|
||||
* request url
|
||||
*/
|
||||
|
||||
exports.token('url', function(req){
|
||||
return req.originalUrl || req.url;
|
||||
});
|
||||
morgan.token('url', function getUrlToken(req) {
|
||||
return req.originalUrl || req.url
|
||||
})
|
||||
|
||||
/**
|
||||
* request method
|
||||
*/
|
||||
|
||||
exports.token('method', function(req){
|
||||
morgan.token('method', function getMethodToken(req) {
|
||||
return req.method;
|
||||
});
|
||||
|
||||
@@ -260,23 +225,28 @@ exports.token('method', function(req){
|
||||
* response time in milliseconds
|
||||
*/
|
||||
|
||||
exports.token('response-time', function(req, res){
|
||||
if (!res._header || !req._startAt) return '';
|
||||
var diff = process.hrtime(req._startAt);
|
||||
var ms = diff[0] * 1e3 + diff[1] * 1e-6;
|
||||
return ms.toFixed(3);
|
||||
});
|
||||
morgan.token('response-time', function getResponseTimeToken(req, res) {
|
||||
if (!req._startAt || !res._startAt) {
|
||||
// missing request and/or response start time
|
||||
return
|
||||
}
|
||||
|
||||
// calculate diff
|
||||
var ms = (res._startAt[0] - req._startAt[0]) * 1e3
|
||||
+ (res._startAt[1] - req._startAt[1]) * 1e-6
|
||||
|
||||
// return truncated value
|
||||
return ms.toFixed(3)
|
||||
})
|
||||
|
||||
/**
|
||||
* current date
|
||||
*/
|
||||
|
||||
exports.token('date', function(req, res, format){
|
||||
format = format || 'web'
|
||||
|
||||
morgan.token('date', function getDateToken(req, res, format) {
|
||||
var date = new Date()
|
||||
|
||||
switch (format) {
|
||||
switch (format || 'web') {
|
||||
case 'clf':
|
||||
return clfdate(date)
|
||||
case 'iso':
|
||||
@@ -290,15 +260,17 @@ exports.token('date', function(req, res, format){
|
||||
* response status code
|
||||
*/
|
||||
|
||||
exports.token('status', function(req, res){
|
||||
return res._header ? res.statusCode : null;
|
||||
});
|
||||
morgan.token('status', function getStatusToken(req, res) {
|
||||
return res._header
|
||||
? String(res.statusCode)
|
||||
: undefined
|
||||
})
|
||||
|
||||
/**
|
||||
* normalized referrer
|
||||
*/
|
||||
|
||||
exports.token('referrer', function(req){
|
||||
morgan.token('referrer', function getReferrerToken(req) {
|
||||
return req.headers['referer'] || req.headers['referrer'];
|
||||
});
|
||||
|
||||
@@ -306,31 +278,35 @@ exports.token('referrer', function(req){
|
||||
* remote address
|
||||
*/
|
||||
|
||||
exports.token('remote-addr', getip);
|
||||
morgan.token('remote-addr', getip)
|
||||
|
||||
/**
|
||||
* remote user
|
||||
*/
|
||||
|
||||
exports.token('remote-user', function (req) {
|
||||
var creds = auth(req)
|
||||
var user = (creds && creds.name) || '-'
|
||||
return user;
|
||||
morgan.token('remote-user', function getRemoteUserToken(req) {
|
||||
// parse basic credentials
|
||||
var credentials = auth(req)
|
||||
|
||||
// return username
|
||||
return credentials
|
||||
? credentials.name
|
||||
: undefined
|
||||
})
|
||||
|
||||
/**
|
||||
* HTTP version
|
||||
*/
|
||||
|
||||
exports.token('http-version', function(req){
|
||||
return req.httpVersionMajor + '.' + req.httpVersionMinor;
|
||||
});
|
||||
morgan.token('http-version', function getHttpVersionToken(req) {
|
||||
return req.httpVersionMajor + '.' + req.httpVersionMinor
|
||||
})
|
||||
|
||||
/**
|
||||
* UA string
|
||||
*/
|
||||
|
||||
exports.token('user-agent', function(req){
|
||||
morgan.token('user-agent', function getUserAgentToken(req) {
|
||||
return req.headers['user-agent'];
|
||||
});
|
||||
|
||||
@@ -338,17 +314,31 @@ exports.token('user-agent', function(req){
|
||||
* request header
|
||||
*/
|
||||
|
||||
exports.token('req', function(req, res, field){
|
||||
return req.headers[field.toLowerCase()];
|
||||
});
|
||||
morgan.token('req', function getRequestToken(req, res, field) {
|
||||
// get header
|
||||
var header = req.headers[field.toLowerCase()]
|
||||
|
||||
return Array.isArray(header)
|
||||
? header.join(', ')
|
||||
: header
|
||||
})
|
||||
|
||||
/**
|
||||
* response header
|
||||
*/
|
||||
|
||||
exports.token('res', function(req, res, field){
|
||||
return (res._headers || {})[field.toLowerCase()];
|
||||
});
|
||||
morgan.token('res', function getResponseTime(req, res, field) {
|
||||
if (!res._header) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
// get header
|
||||
var header = res.getHeader(field)
|
||||
|
||||
return Array.isArray(header)
|
||||
? header.join(', ')
|
||||
: header
|
||||
})
|
||||
|
||||
/**
|
||||
* Format a Date in the common log format.
|
||||
@@ -372,6 +362,90 @@ function clfdate(dateTime) {
|
||||
+ ' +0000'
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile a format string into a function.
|
||||
*
|
||||
* @param {string} format
|
||||
* @return {function}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function compile(format) {
|
||||
if (typeof format !== 'string') {
|
||||
throw new TypeError('argument format must be a string')
|
||||
}
|
||||
|
||||
var fmt = format.replace(/"/g, '\\"')
|
||||
var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg) {
|
||||
return '"\n + (tokens["' + name + '"](req, res, ' + String(JSON.stringify(arg)) + ') || "-") + "'
|
||||
}) + '";'
|
||||
|
||||
return new Function('tokens, req, res', js)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a basic buffering stream.
|
||||
*
|
||||
* @param {object} stream
|
||||
* @param {number} interval
|
||||
* @public
|
||||
*/
|
||||
|
||||
function createBufferStream(stream, interval) {
|
||||
var buf = []
|
||||
var timer = null
|
||||
|
||||
// flush function
|
||||
function flush() {
|
||||
timer = null
|
||||
stream.write(buf.join(''))
|
||||
buf.length = 0
|
||||
}
|
||||
|
||||
// write function
|
||||
function write(str) {
|
||||
if (timer === null) {
|
||||
timer = setTimeout(flush, interval)
|
||||
}
|
||||
|
||||
buf.push(str)
|
||||
}
|
||||
|
||||
// return a minimal "stream"
|
||||
return { write: write }
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a format with the given name.
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {string|function} fmt
|
||||
* @public
|
||||
*/
|
||||
|
||||
function format(name, fmt) {
|
||||
morgan[name] = fmt
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Lookup and compile a named format function.
|
||||
*
|
||||
* @param {string} name
|
||||
* @return {function}
|
||||
* @public
|
||||
*/
|
||||
|
||||
function getFormatFunction(name) {
|
||||
// lookup format
|
||||
var fmt = morgan[name] || name || morgan.default
|
||||
|
||||
// return compiled format
|
||||
return typeof fmt !== 'function'
|
||||
? compile(fmt)
|
||||
: fmt
|
||||
}
|
||||
|
||||
/**
|
||||
* Get request IP address.
|
||||
*
|
||||
@@ -401,3 +475,27 @@ function pad2(num) {
|
||||
return (str.length === 1 ? '0' : '')
|
||||
+ str
|
||||
}
|
||||
|
||||
/**
|
||||
* Record the start time.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function recordStartTime() {
|
||||
this._startAt = process.hrtime()
|
||||
this._startTime = new Date()
|
||||
}
|
||||
|
||||
/**
|
||||
* Define a token function with the given name,
|
||||
* and callback fn(req, res).
|
||||
*
|
||||
* @param {string} name
|
||||
* @param {function} fn
|
||||
* @public
|
||||
*/
|
||||
|
||||
function token(name, fn) {
|
||||
morgan[name] = fn
|
||||
return this
|
||||
}
|
||||
|
||||
24
node_modules/morgan/node_modules/basic-auth/HISTORY.md
generated
vendored
24
node_modules/morgan/node_modules/basic-auth/HISTORY.md
generated
vendored
@@ -1,24 +0,0 @@
|
||||
1.0.2 / 2015-06-12
|
||||
==================
|
||||
|
||||
* Improve error message when `req` argument missing
|
||||
* perf: enable strict mode
|
||||
* perf: hoist regular expression
|
||||
* perf: parse with regular expressions
|
||||
* perf: remove argument reassignment
|
||||
|
||||
1.0.1 / 2015-05-04
|
||||
==================
|
||||
|
||||
* Update readme
|
||||
|
||||
1.0.0 / 2014-07-01
|
||||
==================
|
||||
|
||||
* Support empty password
|
||||
* Support empty username
|
||||
|
||||
0.0.1 / 2013-11-30
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
24
node_modules/morgan/node_modules/basic-auth/LICENSE
generated
vendored
24
node_modules/morgan/node_modules/basic-auth/LICENSE
generated
vendored
@@ -1,24 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 TJ Holowaychuk
|
||||
Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
|
||||
Copyright (c) 2015 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.
|
||||
78
node_modules/morgan/node_modules/basic-auth/README.md
generated
vendored
78
node_modules/morgan/node_modules/basic-auth/README.md
generated
vendored
@@ -1,78 +0,0 @@
|
||||
# basic-auth
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Generic basic auth Authorization header field parser for whatever.
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
$ npm install basic-auth
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var auth = require('basic-auth')
|
||||
```
|
||||
|
||||
### auth(req)
|
||||
|
||||
Get the basic auth credentials from the given request. The `Authorization`
|
||||
header is parsed and if the header is invalid, `undefined` is returned,
|
||||
otherwise an object with `name` and `pass` properties.
|
||||
|
||||
## Example
|
||||
|
||||
Pass a node request or koa Context object to the module exported. If
|
||||
parsing fails `undefined` is returned, otherwise an object with
|
||||
`.name` and `.pass`.
|
||||
|
||||
```js
|
||||
var auth = require('basic-auth');
|
||||
var user = auth(req);
|
||||
// => { name: 'something', pass: 'whatever' }
|
||||
|
||||
```
|
||||
|
||||
### With vanilla node.js http server
|
||||
|
||||
```js
|
||||
var http = require('http')
|
||||
var auth = require('basic-auth')
|
||||
|
||||
// Create server
|
||||
var server = http.createServer(function (req, res) {
|
||||
var credentials = auth(req)
|
||||
|
||||
if (!credentials || credentials.name !== 'john' || credentials.pass !== 'secret') {
|
||||
res.statusCode = 401
|
||||
res.setHeader('WWW-Authenticate', 'Basic realm="example"')
|
||||
res.end('Access denied')
|
||||
} else {
|
||||
res.end('Access granted')
|
||||
}
|
||||
})
|
||||
|
||||
// Listen
|
||||
server.listen(3000)
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/basic-auth.svg
|
||||
[npm-url]: https://npmjs.org/package/basic-auth
|
||||
[node-version-image]: https://img.shields.io/node/v/basic-auth.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/basic-auth/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/basic-auth
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/basic-auth/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/basic-auth?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/basic-auth.svg
|
||||
[downloads-url]: https://npmjs.org/package/basic-auth
|
||||
92
node_modules/morgan/node_modules/basic-auth/index.js
generated
vendored
92
node_modules/morgan/node_modules/basic-auth/index.js
generated
vendored
@@ -1,92 +0,0 @@
|
||||
/*!
|
||||
* morgan
|
||||
* Copyright(c) 2013 TJ Holowaychuk
|
||||
* Copyright(c) 2014 Jonathan Ong
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = auth
|
||||
|
||||
/**
|
||||
* RegExp for basic auth credentials
|
||||
*
|
||||
* credentials = auth-scheme 1*SP token68
|
||||
* auth-scheme = "Basic" ; case insensitive
|
||||
* token68 = 1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"="
|
||||
* @private
|
||||
*/
|
||||
|
||||
var credentialsRegExp = /^ *(?:[Bb][Aa][Ss][Ii][Cc]) +([A-Za-z0-9\-\._~\+\/]+=*) *$/
|
||||
|
||||
/**
|
||||
* RegExp for basic auth user/pass
|
||||
*
|
||||
* user-pass = userid ":" password
|
||||
* userid = *<TEXT excluding ":">
|
||||
* password = *TEXT
|
||||
* @private
|
||||
*/
|
||||
|
||||
var userPassRegExp = /^([^:]*):(.*)$/
|
||||
|
||||
/**
|
||||
* Parse the Authorization header field of a request.
|
||||
*
|
||||
* @param {object} req
|
||||
* @return {object} with .name and .pass
|
||||
* @public
|
||||
*/
|
||||
|
||||
function auth(req) {
|
||||
if (!req) {
|
||||
throw new TypeError('argument req is required')
|
||||
}
|
||||
|
||||
// get header
|
||||
var header = (req.req || req).headers.authorization
|
||||
|
||||
// parse header
|
||||
var header = req.headers.authorization
|
||||
var match = credentialsRegExp.exec(header || '')
|
||||
|
||||
if (!match) {
|
||||
return
|
||||
}
|
||||
|
||||
// decode user pass
|
||||
var userPass = userPassRegExp.exec(decodeBase64(match[1]))
|
||||
|
||||
if (!userPass) {
|
||||
return
|
||||
}
|
||||
|
||||
// return credentials object
|
||||
return new Credentials(userPass[1], userPass[2])
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode base64 string.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function decodeBase64(str) {
|
||||
return new Buffer(str, 'base64').toString()
|
||||
}
|
||||
|
||||
/**
|
||||
* Object to represent user credentials.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function Credentials(name, pass) {
|
||||
this.name = name
|
||||
this.pass = pass
|
||||
}
|
||||
71
node_modules/morgan/node_modules/basic-auth/package.json
generated
vendored
71
node_modules/morgan/node_modules/basic-auth/package.json
generated
vendored
@@ -1,71 +0,0 @@
|
||||
{
|
||||
"name": "basic-auth",
|
||||
"description": "node.js basic auth parser",
|
||||
"version": "1.0.2",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"basic",
|
||||
"auth",
|
||||
"authorization",
|
||||
"basicauth"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/basic-auth.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.15",
|
||||
"mocha": "1.21.5"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --check-leaks --reporter spec --bail",
|
||||
"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": "5e2d7ef5bad393e17ed0035f4926846137559260",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/basic-auth/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jshttp/basic-auth",
|
||||
"_id": "basic-auth@1.0.2",
|
||||
"_shasum": "42900137fb0c91462d14b3739c14bf2bb624171d",
|
||||
"_from": "basic-auth@>=1.0.1 <1.1.0",
|
||||
"_npmVersion": "1.4.28",
|
||||
"_npmUser": {
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "tjholowaychuk",
|
||||
"email": "tj@vision-media.ca"
|
||||
},
|
||||
{
|
||||
"name": "jonathanong",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "dougwilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "jongleberry",
|
||||
"email": "jonathanrichardong@gmail.com"
|
||||
}
|
||||
],
|
||||
"dist": {
|
||||
"shasum": "42900137fb0c91462d14b3739c14bf2bb624171d",
|
||||
"tarball": "http://registry.npmjs.org/basic-auth/-/basic-auth-1.0.2.tgz"
|
||||
},
|
||||
"directories": {},
|
||||
"_resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-1.0.2.tgz",
|
||||
"readme": "ERROR: No README data found!"
|
||||
}
|
||||
108
node_modules/morgan/node_modules/depd/package.json
generated
vendored
108
node_modules/morgan/node_modules/depd/package.json
generated
vendored
File diff suppressed because one or more lines are too long
81
node_modules/morgan/node_modules/on-finished/HISTORY.md
generated
vendored
81
node_modules/morgan/node_modules/on-finished/HISTORY.md
generated
vendored
@@ -1,81 +0,0 @@
|
||||
2.2.1 / 2015-04-22
|
||||
==================
|
||||
|
||||
* Fix `isFinished(req)` when data buffered
|
||||
|
||||
2.2.0 / 2014-12-22
|
||||
==================
|
||||
|
||||
* Add message object to callback arguments
|
||||
|
||||
2.1.1 / 2014-10-22
|
||||
==================
|
||||
|
||||
* Fix handling of pipelined requests
|
||||
|
||||
2.1.0 / 2014-08-16
|
||||
==================
|
||||
|
||||
* Check if `socket` is detached
|
||||
* Return `undefined` for `isFinished` if state unknown
|
||||
|
||||
2.0.0 / 2014-08-16
|
||||
==================
|
||||
|
||||
* Add `isFinished` function
|
||||
* Move to `jshttp` organization
|
||||
* Remove support for plain socket argument
|
||||
* Rename to `on-finished`
|
||||
* Support both `req` and `res` as arguments
|
||||
* deps: ee-first@1.0.5
|
||||
|
||||
1.2.2 / 2014-06-10
|
||||
==================
|
||||
|
||||
* Reduce listeners added to emitters
|
||||
- avoids "event emitter leak" warnings when used multiple times on same request
|
||||
|
||||
1.2.1 / 2014-06-08
|
||||
==================
|
||||
|
||||
* Fix returned value when already finished
|
||||
|
||||
1.2.0 / 2014-06-05
|
||||
==================
|
||||
|
||||
* Call callback when called on already-finished socket
|
||||
|
||||
1.1.4 / 2014-05-27
|
||||
==================
|
||||
|
||||
* Support node.js 0.8
|
||||
|
||||
1.1.3 / 2014-04-30
|
||||
==================
|
||||
|
||||
* Make sure errors passed as instanceof `Error`
|
||||
|
||||
1.1.2 / 2014-04-18
|
||||
==================
|
||||
|
||||
* Default the `socket` to passed-in object
|
||||
|
||||
1.1.1 / 2014-01-16
|
||||
==================
|
||||
|
||||
* Rename module to `finished`
|
||||
|
||||
1.1.0 / 2013-12-25
|
||||
==================
|
||||
|
||||
* Call callback when called on already-errored socket
|
||||
|
||||
1.0.1 / 2013-12-20
|
||||
==================
|
||||
|
||||
* Actually pass the error to the callback
|
||||
|
||||
1.0.0 / 2013-12-20
|
||||
==================
|
||||
|
||||
* Initial release
|
||||
23
node_modules/morgan/node_modules/on-finished/LICENSE
generated
vendored
23
node_modules/morgan/node_modules/on-finished/LICENSE
generated
vendored
@@ -1,23 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Jonathan Ong <me@jongleberry.com>
|
||||
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.
|
||||
109
node_modules/morgan/node_modules/on-finished/README.md
generated
vendored
109
node_modules/morgan/node_modules/on-finished/README.md
generated
vendored
@@ -1,109 +0,0 @@
|
||||
# on-finished
|
||||
|
||||
[![NPM Version][npm-image]][npm-url]
|
||||
[![NPM Downloads][downloads-image]][downloads-url]
|
||||
[![Node.js Version][node-version-image]][node-version-url]
|
||||
[![Build Status][travis-image]][travis-url]
|
||||
[![Test Coverage][coveralls-image]][coveralls-url]
|
||||
|
||||
Execute a callback when a request closes, finishes, or errors.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install on-finished
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var onFinished = require('on-finished')
|
||||
```
|
||||
|
||||
### onFinished(res, listener)
|
||||
|
||||
Attach a listener to listen for the response to finish. The listener will
|
||||
be invoked only once when the response finished. If the response finished
|
||||
to to an error, the first argument will contain the error. If the response
|
||||
has already finished, the listener will be invoked.
|
||||
|
||||
Listening to the end of a response would be used to close things associated
|
||||
with the response, like open files.
|
||||
|
||||
Listener is invoked as `listener(err, res)`.
|
||||
|
||||
```js
|
||||
onFinished(res, function (err, res) {
|
||||
// clean up open fds, etc.
|
||||
// err contains the error is request error'd
|
||||
})
|
||||
```
|
||||
|
||||
### onFinished(req, listener)
|
||||
|
||||
Attach a listener to listen for the request to finish. The listener will
|
||||
be invoked only once when the request finished. If the request finished
|
||||
to to an error, the first argument will contain the error. If the request
|
||||
has already finished, the listener will be invoked.
|
||||
|
||||
Listening to the end of a request would be used to know when to continue
|
||||
after reading the data.
|
||||
|
||||
Listener is invoked as `listener(err, req)`.
|
||||
|
||||
```js
|
||||
var data = ''
|
||||
|
||||
req.setEncoding('utf8')
|
||||
res.on('data', function (str) {
|
||||
data += str
|
||||
})
|
||||
|
||||
onFinished(req, function (err, req) {
|
||||
// data is read unless there is err
|
||||
})
|
||||
```
|
||||
|
||||
### onFinished.isFinished(res)
|
||||
|
||||
Determine if `res` is already finished. This would be useful to check and
|
||||
not even start certain operations if the response has already finished.
|
||||
|
||||
### onFinished.isFinished(req)
|
||||
|
||||
Determine if `req` is already finished. This would be useful to check and
|
||||
not even start certain operations if the request has already finished.
|
||||
|
||||
### Example
|
||||
|
||||
The following code ensures that file descriptors are always closed
|
||||
once the response finishes.
|
||||
|
||||
```js
|
||||
var destroy = require('destroy')
|
||||
var http = require('http')
|
||||
var onFinished = require('on-finished')
|
||||
|
||||
http.createServer(function onRequest(req, res) {
|
||||
var stream = fs.createReadStream('package.json')
|
||||
stream.pipe(res)
|
||||
onFinished(res, function (err) {
|
||||
destroy(stream)
|
||||
})
|
||||
})
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/on-finished.svg
|
||||
[npm-url]: https://npmjs.org/package/on-finished
|
||||
[node-version-image]: https://img.shields.io/node/v/on-finished.svg
|
||||
[node-version-url]: http://nodejs.org/download/
|
||||
[travis-image]: https://img.shields.io/travis/jshttp/on-finished/master.svg
|
||||
[travis-url]: https://travis-ci.org/jshttp/on-finished
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-finished/master.svg
|
||||
[coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master
|
||||
[downloads-image]: https://img.shields.io/npm/dm/on-finished.svg
|
||||
[downloads-url]: https://npmjs.org/package/on-finished
|
||||
191
node_modules/morgan/node_modules/on-finished/index.js
generated
vendored
191
node_modules/morgan/node_modules/on-finished/index.js
generated
vendored
@@ -1,191 +0,0 @@
|
||||
/*!
|
||||
* on-finished
|
||||
* Copyright(c) 2013 Jonathan Ong
|
||||
* Copyright(c) 2014 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
*/
|
||||
|
||||
module.exports = onFinished;
|
||||
module.exports.isFinished = isFinished;
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var first = require('ee-first')
|
||||
|
||||
/**
|
||||
* Variables.
|
||||
*/
|
||||
|
||||
/* istanbul ignore next */
|
||||
var defer = typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
|
||||
/**
|
||||
* Invoke callback when the response has finished, useful for
|
||||
* cleaning up resources afterwards.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @param {function} listener
|
||||
* @return {object}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function onFinished(msg, listener) {
|
||||
if (isFinished(msg) !== false) {
|
||||
defer(listener, null, msg)
|
||||
return msg
|
||||
}
|
||||
|
||||
// attach the listener to the message
|
||||
attachListener(msg, listener)
|
||||
|
||||
return msg
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if message is already finished.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {boolean}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function isFinished(msg) {
|
||||
var socket = msg.socket
|
||||
|
||||
if (typeof msg.finished === 'boolean') {
|
||||
// OutgoingMessage
|
||||
return Boolean(msg.finished || (socket && !socket.writable))
|
||||
}
|
||||
|
||||
if (typeof msg.complete === 'boolean') {
|
||||
// IncomingMessage
|
||||
return Boolean(!socket || !socket.readable || (msg.complete && !msg.readable))
|
||||
}
|
||||
|
||||
// don't know
|
||||
return undefined
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a finished listener to the message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @param {function} callback
|
||||
* @private
|
||||
*/
|
||||
|
||||
function attachFinishedListener(msg, callback) {
|
||||
var eeMsg
|
||||
var eeSocket
|
||||
var finished = false
|
||||
|
||||
function onFinish(error) {
|
||||
eeMsg.cancel()
|
||||
eeSocket.cancel()
|
||||
|
||||
finished = true
|
||||
callback(error)
|
||||
}
|
||||
|
||||
// finished on first message event
|
||||
eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish)
|
||||
|
||||
function onSocket(socket) {
|
||||
// remove listener
|
||||
msg.removeListener('socket', onSocket)
|
||||
|
||||
if (finished) return
|
||||
if (eeMsg !== eeSocket) return
|
||||
|
||||
// finished on first socket event
|
||||
eeSocket = first([[socket, 'error', 'close']], onFinish)
|
||||
}
|
||||
|
||||
if (msg.socket) {
|
||||
// socket already assigned
|
||||
onSocket(msg.socket)
|
||||
return
|
||||
}
|
||||
|
||||
// wait for socket to be assigned
|
||||
msg.on('socket', onSocket)
|
||||
|
||||
if (msg.socket === undefined) {
|
||||
// node.js 0.8 patch
|
||||
patchAssignSocket(msg, onSocket)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach the listener to the message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {function}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function attachListener(msg, listener) {
|
||||
var attached = msg.__onFinished
|
||||
|
||||
// create a private single listener with queue
|
||||
if (!attached || !attached.queue) {
|
||||
attached = msg.__onFinished = createListener(msg)
|
||||
attachFinishedListener(msg, attached)
|
||||
}
|
||||
|
||||
attached.queue.push(listener)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create listener on message.
|
||||
*
|
||||
* @param {object} msg
|
||||
* @return {function}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function createListener(msg) {
|
||||
function listener(err) {
|
||||
if (msg.__onFinished === listener) msg.__onFinished = null
|
||||
if (!listener.queue) return
|
||||
|
||||
var queue = listener.queue
|
||||
listener.queue = null
|
||||
|
||||
for (var i = 0; i < queue.length; i++) {
|
||||
queue[i](err, msg)
|
||||
}
|
||||
}
|
||||
|
||||
listener.queue = []
|
||||
|
||||
return listener
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch ServerResponse.prototype.assignSocket for node.js 0.8.
|
||||
*
|
||||
* @param {ServerResponse} res
|
||||
* @param {function} callback
|
||||
* @private
|
||||
*/
|
||||
|
||||
function patchAssignSocket(res, callback) {
|
||||
var assignSocket = res.assignSocket
|
||||
|
||||
if (typeof assignSocket !== 'function') return
|
||||
|
||||
// res.on('socket', callback) is broken in 0.8
|
||||
res.assignSocket = function _assignSocket(socket) {
|
||||
assignSocket.call(this, socket)
|
||||
callback(socket)
|
||||
}
|
||||
}
|
||||
22
node_modules/morgan/node_modules/on-finished/node_modules/ee-first/LICENSE
generated
vendored
22
node_modules/morgan/node_modules/on-finished/node_modules/ee-first/LICENSE
generated
vendored
@@ -1,22 +0,0 @@
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Jonathan Ong me@jongleberry.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.
|
||||
80
node_modules/morgan/node_modules/on-finished/node_modules/ee-first/README.md
generated
vendored
80
node_modules/morgan/node_modules/on-finished/node_modules/ee-first/README.md
generated
vendored
@@ -1,80 +0,0 @@
|
||||
# EE First
|
||||
|
||||
[![NPM version][npm-image]][npm-url]
|
||||
[![Build status][travis-image]][travis-url]
|
||||
[![Test coverage][coveralls-image]][coveralls-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
[![Gittip][gittip-image]][gittip-url]
|
||||
|
||||
Get the first event in a set of event emitters and event pairs,
|
||||
then clean up after itself.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install ee-first
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
```js
|
||||
var first = require('ee-first')
|
||||
```
|
||||
|
||||
### first(arr, listener)
|
||||
|
||||
Invoke `listener` on the first event from the list specified in `arr`. `arr` is
|
||||
an array of arrays, with each array in the format `[ee, ...event]`. `listener`
|
||||
will be called only once, the first time any of the given events are emitted. If
|
||||
`error` is one of the listened events, then if that fires first, the `listener`
|
||||
will be given the `err` argument.
|
||||
|
||||
The `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the
|
||||
first argument emitted from an `error` event, if applicable; `ee` is the event
|
||||
emitter that fired; `event` is the string event name that fired; and `args` is an
|
||||
array of the arguments that were emitted on the event.
|
||||
|
||||
```js
|
||||
var ee1 = new EventEmitter()
|
||||
var ee2 = new EventEmitter()
|
||||
|
||||
first([
|
||||
[ee1, 'close', 'end', 'error'],
|
||||
[ee2, 'error']
|
||||
], function (err, ee, event, args) {
|
||||
// listener invoked
|
||||
})
|
||||
```
|
||||
|
||||
#### .cancel()
|
||||
|
||||
The group of listeners can be cancelled before being invoked and have all the event
|
||||
listeners removed from the underlying event emitters.
|
||||
|
||||
```js
|
||||
var thunk = first([
|
||||
[ee1, 'close', 'end', 'error'],
|
||||
[ee2, 'error']
|
||||
], function (err, ee, event, args) {
|
||||
// listener invoked
|
||||
})
|
||||
|
||||
// cancel and clean up
|
||||
thunk.cancel()
|
||||
```
|
||||
|
||||
[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square
|
||||
[npm-url]: https://npmjs.org/package/ee-first
|
||||
[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square
|
||||
[github-url]: https://github.com/jonathanong/ee-first/tags
|
||||
[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square
|
||||
[travis-url]: https://travis-ci.org/jonathanong/ee-first
|
||||
[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square
|
||||
[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master
|
||||
[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square
|
||||
[license-url]: LICENSE.md
|
||||
[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square
|
||||
[downloads-url]: https://npmjs.org/package/ee-first
|
||||
[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square
|
||||
[gittip-url]: https://www.gittip.com/jonathanong/
|
||||
68
node_modules/morgan/node_modules/on-finished/node_modules/ee-first/index.js
generated
vendored
68
node_modules/morgan/node_modules/on-finished/node_modules/ee-first/index.js
generated
vendored
@@ -1,68 +0,0 @@
|
||||
|
||||
module.exports = function first(stuff, done) {
|
||||
if (!Array.isArray(stuff))
|
||||
throw new TypeError('arg must be an array of [ee, events...] arrays')
|
||||
|
||||
var cleanups = []
|
||||
|
||||
for (var i = 0; i < stuff.length; i++) {
|
||||
var arr = stuff[i]
|
||||
|
||||
if (!Array.isArray(arr) || arr.length < 2)
|
||||
throw new TypeError('each array member must be [ee, events...]')
|
||||
|
||||
var ee = arr[0]
|
||||
|
||||
for (var j = 1; j < arr.length; j++) {
|
||||
var event = arr[j]
|
||||
var fn = listener(event, callback)
|
||||
|
||||
// listen to the event
|
||||
ee.on(event, fn)
|
||||
// push this listener to the list of cleanups
|
||||
cleanups.push({
|
||||
ee: ee,
|
||||
event: event,
|
||||
fn: fn,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function callback() {
|
||||
cleanup()
|
||||
done.apply(null, arguments)
|
||||
}
|
||||
|
||||
function cleanup() {
|
||||
var x
|
||||
for (var i = 0; i < cleanups.length; i++) {
|
||||
x = cleanups[i]
|
||||
x.ee.removeListener(x.event, x.fn)
|
||||
}
|
||||
}
|
||||
|
||||
function thunk(fn) {
|
||||
done = fn
|
||||
}
|
||||
|
||||
thunk.cancel = cleanup
|
||||
|
||||
return thunk
|
||||
}
|
||||
|
||||
function listener(event, done) {
|
||||
return function onevent(arg1) {
|
||||
var args = new Array(arguments.length)
|
||||
var ee = this
|
||||
var err = event === 'error'
|
||||
? arg1
|
||||
: null
|
||||
|
||||
// copy args to prevent arguments escaping scope
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
args[i] = arguments[i]
|
||||
}
|
||||
|
||||
done(err, ee, event, args)
|
||||
}
|
||||
}
|
||||
44
node_modules/morgan/node_modules/on-finished/node_modules/ee-first/package.json
generated
vendored
44
node_modules/morgan/node_modules/on-finished/node_modules/ee-first/package.json
generated
vendored
@@ -1,44 +0,0 @@
|
||||
{
|
||||
"name": "ee-first",
|
||||
"description": "return the first event in a set of ee/event pairs",
|
||||
"version": "1.1.0",
|
||||
"author": {
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jonathanong/ee-first.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.2",
|
||||
"mocha": "1"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"LICENSE"
|
||||
],
|
||||
"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/"
|
||||
},
|
||||
"readme": "# EE First\r\n\r\n[![NPM version][npm-image]][npm-url]\r\n[![Build status][travis-image]][travis-url]\r\n[![Test coverage][coveralls-image]][coveralls-url]\r\n[![License][license-image]][license-url]\r\n[![Downloads][downloads-image]][downloads-url]\r\n[![Gittip][gittip-image]][gittip-url]\r\n\r\nGet the first event in a set of event emitters and event pairs,\r\nthen clean up after itself.\r\n\r\n## Install\r\n\r\n```sh\r\n$ npm install ee-first\r\n```\r\n\r\n## API\r\n\r\n```js\r\nvar first = require('ee-first')\r\n```\r\n\r\n### first(arr, listener)\r\n\r\nInvoke `listener` on the first event from the list specified in `arr`. `arr` is\r\nan array of arrays, with each array in the format `[ee, ...event]`. `listener`\r\nwill be called only once, the first time any of the given events are emitted. If\r\n`error` is one of the listened events, then if that fires first, the `listener`\r\nwill be given the `err` argument.\r\n\r\nThe `listener` is invoked as `listener(err, ee, event, args)`, where `err` is the\r\nfirst argument emitted from an `error` event, if applicable; `ee` is the event\r\nemitter that fired; `event` is the string event name that fired; and `args` is an\r\narray of the arguments that were emitted on the event.\r\n\r\n```js\r\nvar ee1 = new EventEmitter()\r\nvar ee2 = new EventEmitter()\r\n\r\nfirst([\r\n [ee1, 'close', 'end', 'error'],\r\n [ee2, 'error']\r\n], function (err, ee, event, args) {\r\n // listener invoked\r\n})\r\n```\r\n\r\n#### .cancel()\r\n\r\nThe group of listeners can be cancelled before being invoked and have all the event\r\nlisteners removed from the underlying event emitters.\r\n\r\n```js\r\nvar thunk = first([\r\n [ee1, 'close', 'end', 'error'],\r\n [ee2, 'error']\r\n], function (err, ee, event, args) {\r\n // listener invoked\r\n})\r\n\r\n// cancel and clean up\r\nthunk.cancel()\r\n```\r\n\r\n[npm-image]: https://img.shields.io/npm/v/ee-first.svg?style=flat-square\r\n[npm-url]: https://npmjs.org/package/ee-first\r\n[github-tag]: http://img.shields.io/github/tag/jonathanong/ee-first.svg?style=flat-square\r\n[github-url]: https://github.com/jonathanong/ee-first/tags\r\n[travis-image]: https://img.shields.io/travis/jonathanong/ee-first.svg?style=flat-square\r\n[travis-url]: https://travis-ci.org/jonathanong/ee-first\r\n[coveralls-image]: https://img.shields.io/coveralls/jonathanong/ee-first.svg?style=flat-square\r\n[coveralls-url]: https://coveralls.io/r/jonathanong/ee-first?branch=master\r\n[license-image]: http://img.shields.io/npm/l/ee-first.svg?style=flat-square\r\n[license-url]: LICENSE.md\r\n[downloads-image]: http://img.shields.io/npm/dm/ee-first.svg?style=flat-square\r\n[downloads-url]: https://npmjs.org/package/ee-first\r\n[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square\r\n[gittip-url]: https://www.gittip.com/jonathanong/\r\n",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jonathanong/ee-first/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jonathanong/ee-first#readme",
|
||||
"_id": "ee-first@1.1.0",
|
||||
"_shasum": "6a0d7c6221e490feefd92ec3f441c9ce8cd097f4",
|
||||
"_resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.0.tgz",
|
||||
"_from": "ee-first@1.1.0"
|
||||
}
|
||||
51
node_modules/morgan/node_modules/on-finished/package.json
generated
vendored
51
node_modules/morgan/node_modules/on-finished/package.json
generated
vendored
@@ -1,51 +0,0 @@
|
||||
{
|
||||
"name": "on-finished",
|
||||
"description": "Execute a callback when a request closes, finishes, or errors",
|
||||
"version": "2.2.1",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/on-finished.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "~2.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"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/"
|
||||
},
|
||||
"readme": "# on-finished\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Node.js Version][node-version-image]][node-version-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nExecute a callback when a request closes, finishes, or errors.\n\n## Install\n\n```sh\n$ npm install on-finished\n```\n\n## API\n\n```js\nvar onFinished = require('on-finished')\n```\n\n### onFinished(res, listener)\n\nAttach a listener to listen for the response to finish. The listener will\nbe invoked only once when the response finished. If the response finished\nto to an error, the first argument will contain the error. If the response\nhas already finished, the listener will be invoked.\n\nListening to the end of a response would be used to close things associated\nwith the response, like open files.\n\nListener is invoked as `listener(err, res)`.\n\n```js\nonFinished(res, function (err, res) {\n // clean up open fds, etc.\n // err contains the error is request error'd\n})\n```\n\n### onFinished(req, listener)\n\nAttach a listener to listen for the request to finish. The listener will\nbe invoked only once when the request finished. If the request finished\nto to an error, the first argument will contain the error. If the request\nhas already finished, the listener will be invoked.\n\nListening to the end of a request would be used to know when to continue\nafter reading the data.\n\nListener is invoked as `listener(err, req)`.\n\n```js\nvar data = ''\n\nreq.setEncoding('utf8')\nres.on('data', function (str) {\n data += str\n})\n\nonFinished(req, function (err, req) {\n // data is read unless there is err\n})\n```\n\n### onFinished.isFinished(res)\n\nDetermine if `res` is already finished. This would be useful to check and\nnot even start certain operations if the response has already finished.\n\n### onFinished.isFinished(req)\n\nDetermine if `req` is already finished. This would be useful to check and\nnot even start certain operations if the request has already finished.\n\n### Example\n\nThe following code ensures that file descriptors are always closed\nonce the response finishes.\n\n```js\nvar destroy = require('destroy')\nvar http = require('http')\nvar onFinished = require('on-finished')\n\nhttp.createServer(function onRequest(req, res) {\n var stream = fs.createReadStream('package.json')\n stream.pipe(res)\n onFinished(res, function (err) {\n destroy(stream)\n })\n})\n```\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/on-finished.svg\n[npm-url]: https://npmjs.org/package/on-finished\n[node-version-image]: https://img.shields.io/node/v/on-finished.svg\n[node-version-url]: http://nodejs.org/download/\n[travis-image]: https://img.shields.io/travis/jshttp/on-finished/master.svg\n[travis-url]: https://travis-ci.org/jshttp/on-finished\n[coveralls-image]: https://img.shields.io/coveralls/jshttp/on-finished/master.svg\n[coveralls-url]: https://coveralls.io/r/jshttp/on-finished?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/on-finished.svg\n[downloads-url]: https://npmjs.org/package/on-finished\n",
|
||||
"readmeFilename": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/on-finished/issues"
|
||||
},
|
||||
"homepage": "https://github.com/jshttp/on-finished#readme",
|
||||
"_id": "on-finished@2.2.1",
|
||||
"_shasum": "5c85c1cc36299f78029653f667f27b6b99ebc029",
|
||||
"_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.2.1.tgz",
|
||||
"_from": "on-finished@>=2.2.1 <2.3.0"
|
||||
}
|
||||
116
node_modules/morgan/package.json
generated
vendored
116
node_modules/morgan/package.json
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user