Actualizacion de seguridad
This commit is contained in:
10
node_modules/on-finished/HISTORY.md
generated
vendored
10
node_modules/on-finished/HISTORY.md
generated
vendored
@@ -1,3 +1,13 @@
|
||||
2.4.1 / 2022-02-22
|
||||
==================
|
||||
|
||||
* Fix error on early async hooks implementations
|
||||
|
||||
2.4.0 / 2022-02-21
|
||||
==================
|
||||
|
||||
* Prevent loss of async hooks context
|
||||
|
||||
2.3.0 / 2015-05-26
|
||||
==================
|
||||
|
||||
|
||||
48
node_modules/on-finished/README.md
generated
vendored
48
node_modules/on-finished/README.md
generated
vendored
@@ -1,15 +1,19 @@
|
||||
# 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]
|
||||
[![NPM Version][npm-version-image]][npm-url]
|
||||
[![NPM Downloads][npm-downloads-image]][npm-url]
|
||||
[![Node.js Version][node-image]][node-url]
|
||||
[![Build Status][ci-image]][ci-url]
|
||||
[![Coverage Status][coveralls-image]][coveralls-url]
|
||||
|
||||
Execute a callback when a HTTP request closes, finishes, or errors.
|
||||
|
||||
## Install
|
||||
|
||||
This is a [Node.js](https://nodejs.org/en/) module available through the
|
||||
[npm registry](https://www.npmjs.com/). Installation is done using the
|
||||
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
|
||||
|
||||
```sh
|
||||
$ npm install on-finished
|
||||
```
|
||||
@@ -32,10 +36,12 @@ with the response, like open files.
|
||||
|
||||
Listener is invoked as `listener(err, res)`.
|
||||
|
||||
<!-- eslint-disable handle-callback-err -->
|
||||
|
||||
```js
|
||||
onFinished(res, function (err, res) {
|
||||
// clean up open fds, etc.
|
||||
// err contains the error is request error'd
|
||||
// err contains the error if request error'd
|
||||
})
|
||||
```
|
||||
|
||||
@@ -51,11 +57,13 @@ after reading the data.
|
||||
|
||||
Listener is invoked as `listener(err, req)`.
|
||||
|
||||
<!-- eslint-disable handle-callback-err -->
|
||||
|
||||
```js
|
||||
var data = ''
|
||||
|
||||
req.setEncoding('utf8')
|
||||
res.on('data', function (str) {
|
||||
req.on('data', function (str) {
|
||||
data += str
|
||||
})
|
||||
|
||||
@@ -97,7 +105,7 @@ interface**. This means if the `CONNECT` request contains a request entity,
|
||||
the request will be considered "finished" even before it has been read.
|
||||
|
||||
There is no such thing as a response object to a `CONNECT` request in
|
||||
Node.js, so there is no support for for one.
|
||||
Node.js, so there is no support for one.
|
||||
|
||||
### HTTP Upgrade request
|
||||
|
||||
@@ -117,7 +125,7 @@ entity, the request will be considered "finished" even before it has been
|
||||
read.
|
||||
|
||||
There is no such thing as a response object to a `Upgrade` request in
|
||||
Node.js, so there is no support for for one.
|
||||
Node.js, so there is no support for one.
|
||||
|
||||
## Example
|
||||
|
||||
@@ -126,13 +134,14 @@ once the response finishes.
|
||||
|
||||
```js
|
||||
var destroy = require('destroy')
|
||||
var fs = require('fs')
|
||||
var http = require('http')
|
||||
var onFinished = require('on-finished')
|
||||
|
||||
http.createServer(function onRequest(req, res) {
|
||||
http.createServer(function onRequest (req, res) {
|
||||
var stream = fs.createReadStream('package.json')
|
||||
stream.pipe(res)
|
||||
onFinished(res, function (err) {
|
||||
onFinished(res, function () {
|
||||
destroy(stream)
|
||||
})
|
||||
})
|
||||
@@ -142,13 +151,12 @@ http.createServer(function onRequest(req, res) {
|
||||
|
||||
[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
|
||||
[ci-image]: https://badgen.net/github/checks/jshttp/on-finished/master?label=ci
|
||||
[ci-url]: https://github.com/jshttp/on-finished/actions/workflows/ci.yml
|
||||
[coveralls-image]: https://badgen.net/coveralls/c/github/jshttp/on-finished/master
|
||||
[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
|
||||
[node-image]: https://badgen.net/npm/node/on-finished
|
||||
[node-url]: https://nodejs.org/en/download
|
||||
[npm-downloads-image]: https://badgen.net/npm/dm/on-finished
|
||||
[npm-url]: https://npmjs.org/package/on-finished
|
||||
[npm-version-image]: https://badgen.net/npm/v/on-finished
|
||||
|
||||
64
node_modules/on-finished/index.js
generated
vendored
64
node_modules/on-finished/index.js
generated
vendored
@@ -20,6 +20,7 @@ module.exports.isFinished = isFinished
|
||||
* @private
|
||||
*/
|
||||
|
||||
var asyncHooks = tryRequireAsyncHooks()
|
||||
var first = require('ee-first')
|
||||
|
||||
/**
|
||||
@@ -30,7 +31,7 @@ var first = require('ee-first')
|
||||
/* istanbul ignore next */
|
||||
var defer = typeof setImmediate === 'function'
|
||||
? setImmediate
|
||||
: function(fn){ process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
: function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) }
|
||||
|
||||
/**
|
||||
* Invoke callback when the response has finished, useful for
|
||||
@@ -42,14 +43,14 @@ var defer = typeof setImmediate === 'function'
|
||||
* @public
|
||||
*/
|
||||
|
||||
function onFinished(msg, listener) {
|
||||
function onFinished (msg, listener) {
|
||||
if (isFinished(msg) !== false) {
|
||||
defer(listener, null, msg)
|
||||
return msg
|
||||
}
|
||||
|
||||
// attach the listener to the message
|
||||
attachListener(msg, listener)
|
||||
attachListener(msg, wrap(listener))
|
||||
|
||||
return msg
|
||||
}
|
||||
@@ -62,7 +63,7 @@ function onFinished(msg, listener) {
|
||||
* @public
|
||||
*/
|
||||
|
||||
function isFinished(msg) {
|
||||
function isFinished (msg) {
|
||||
var socket = msg.socket
|
||||
|
||||
if (typeof msg.finished === 'boolean') {
|
||||
@@ -87,12 +88,12 @@ function isFinished(msg) {
|
||||
* @private
|
||||
*/
|
||||
|
||||
function attachFinishedListener(msg, callback) {
|
||||
function attachFinishedListener (msg, callback) {
|
||||
var eeMsg
|
||||
var eeSocket
|
||||
var finished = false
|
||||
|
||||
function onFinish(error) {
|
||||
function onFinish (error) {
|
||||
eeMsg.cancel()
|
||||
eeSocket.cancel()
|
||||
|
||||
@@ -103,7 +104,7 @@ function attachFinishedListener(msg, callback) {
|
||||
// finished on first message event
|
||||
eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish)
|
||||
|
||||
function onSocket(socket) {
|
||||
function onSocket (socket) {
|
||||
// remove listener
|
||||
msg.removeListener('socket', onSocket)
|
||||
|
||||
@@ -124,7 +125,7 @@ function attachFinishedListener(msg, callback) {
|
||||
msg.on('socket', onSocket)
|
||||
|
||||
if (msg.socket === undefined) {
|
||||
// node.js 0.8 patch
|
||||
// istanbul ignore next: node.js 0.8 patch
|
||||
patchAssignSocket(msg, onSocket)
|
||||
}
|
||||
}
|
||||
@@ -137,7 +138,7 @@ function attachFinishedListener(msg, callback) {
|
||||
* @private
|
||||
*/
|
||||
|
||||
function attachListener(msg, listener) {
|
||||
function attachListener (msg, listener) {
|
||||
var attached = msg.__onFinished
|
||||
|
||||
// create a private single listener with queue
|
||||
@@ -157,8 +158,8 @@ function attachListener(msg, listener) {
|
||||
* @private
|
||||
*/
|
||||
|
||||
function createListener(msg) {
|
||||
function listener(err) {
|
||||
function createListener (msg) {
|
||||
function listener (err) {
|
||||
if (msg.__onFinished === listener) msg.__onFinished = null
|
||||
if (!listener.queue) return
|
||||
|
||||
@@ -183,14 +184,51 @@ function createListener(msg) {
|
||||
* @private
|
||||
*/
|
||||
|
||||
function patchAssignSocket(res, callback) {
|
||||
// istanbul ignore next: node.js 0.8 patch
|
||||
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) {
|
||||
res.assignSocket = function _assignSocket (socket) {
|
||||
assignSocket.call(this, socket)
|
||||
callback(socket)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to require async_hooks
|
||||
* @private
|
||||
*/
|
||||
|
||||
function tryRequireAsyncHooks () {
|
||||
try {
|
||||
return require('async_hooks')
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrap function with async resource, if possible.
|
||||
* AsyncResource.bind static method backported.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function wrap (fn) {
|
||||
var res
|
||||
|
||||
// create anonymous resource
|
||||
if (asyncHooks.AsyncResource) {
|
||||
res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn')
|
||||
}
|
||||
|
||||
// incompatible node.js
|
||||
if (!res || !res.runInAsyncScope) {
|
||||
return fn
|
||||
}
|
||||
|
||||
// return bound function
|
||||
return res.runInAsyncScope.bind(res, fn, null)
|
||||
}
|
||||
|
||||
74
node_modules/on-finished/package.json
generated
vendored
74
node_modules/on-finished/package.json
generated
vendored
@@ -1,53 +1,26 @@
|
||||
{
|
||||
"_from": "on-finished@~2.3.0",
|
||||
"_id": "on-finished@2.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
||||
"_location": "/on-finished",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "on-finished@~2.3.0",
|
||||
"name": "on-finished",
|
||||
"escapedName": "on-finished",
|
||||
"rawSpec": "~2.3.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "~2.3.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/body-parser",
|
||||
"/express",
|
||||
"/finalhandler",
|
||||
"/send"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
||||
"_shasum": "20f1336481b083cd75337992a16971aa2d906947",
|
||||
"_spec": "on-finished@~2.3.0",
|
||||
"_where": "/home/pablinux/Projects/Node/app_sigma/node_modules/express",
|
||||
"bugs": {
|
||||
"url": "https://github.com/jshttp/on-finished/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"name": "on-finished",
|
||||
"description": "Execute a callback when a request closes, finishes, or errors",
|
||||
"version": "2.4.1",
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
{
|
||||
"name": "Jonathan Ong",
|
||||
"email": "me@jongleberry.com",
|
||||
"url": "http://jongleberry.com"
|
||||
}
|
||||
"Douglas Christopher Wilson <doug@somethingdoug.com>",
|
||||
"Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"
|
||||
],
|
||||
"license": "MIT",
|
||||
"repository": "jshttp/on-finished",
|
||||
"dependencies": {
|
||||
"ee-first": "1.1.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Execute a callback when a request closes, finishes, or errors",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.9",
|
||||
"mocha": "2.2.5"
|
||||
"eslint": "7.32.0",
|
||||
"eslint-config-standard": "14.1.1",
|
||||
"eslint-plugin-import": "2.25.4",
|
||||
"eslint-plugin-markdown": "2.2.1",
|
||||
"eslint-plugin-node": "11.1.0",
|
||||
"eslint-plugin-promise": "5.2.0",
|
||||
"eslint-plugin-standard": "4.1.0",
|
||||
"mocha": "9.2.1",
|
||||
"nyc": "15.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
@@ -57,17 +30,10 @@
|
||||
"LICENSE",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/jshttp/on-finished#readme",
|
||||
"license": "MIT",
|
||||
"name": "on-finished",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/jshttp/on-finished.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
},
|
||||
"version": "2.3.0"
|
||||
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
|
||||
"test-cov": "nyc --reporter=html --reporter=text npm test"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user