diff --git a/patches/body-parser+1.20.1.patch b/patches/body-parser+1.20.1.patch new file mode 100644 index 0000000000..b41d212440 --- /dev/null +++ b/patches/body-parser+1.20.1.patch @@ -0,0 +1,44 @@ +diff --git a/node_modules/body-parser/lib/read.js b/node_modules/body-parser/lib/read.js +index fce6283..6131c31 100644 +--- a/node_modules/body-parser/lib/read.js ++++ b/node_modules/body-parser/lib/read.js +@@ -18,7 +18,7 @@ var iconv = require('iconv-lite') + var onFinished = require('on-finished') + var unpipe = require('unpipe') + var zlib = require('zlib') +- ++var Stream = require('stream') + /** + * Module exports. + */ +@@ -166,25 +166,25 @@ function contentstream (req, debug, inflate) { + case 'deflate': + stream = zlib.createInflate() + debug('inflate body') +- req.pipe(stream) ++ // req.pipe(stream) + break + case 'gzip': + stream = zlib.createGunzip() + debug('gunzip body') +- req.pipe(stream) ++ // req.pipe(stream) + break + case 'identity': + stream = req + stream.length = length +- break ++ return req + default: + throw createError(415, 'unsupported content encoding "' + encoding + '"', { + encoding: encoding, + type: 'encoding.unsupported' + }) + } +- +- return stream ++ var pass = new Stream.PassThrough(); Stream.pipeline(req, stream, pass, () => {}) ++ return pass + } + + /** diff --git a/patches/express++send+0.18.0.patch b/patches/express++send+0.18.0.patch new file mode 100644 index 0000000000..323c6eace0 --- /dev/null +++ b/patches/express++send+0.18.0.patch @@ -0,0 +1,57 @@ +diff --git a/node_modules/express/node_modules/send/index.js b/node_modules/express/node_modules/send/index.js +index 89afd7e..de56daf 100644 +--- a/node_modules/express/node_modules/send/index.js ++++ b/node_modules/express/node_modules/send/index.js +@@ -789,29 +789,29 @@ SendStream.prototype.stream = function stream (path, options) { + // pipe + var stream = fs.createReadStream(path, options) + this.emit('stream', stream) +- stream.pipe(res) +- +- // cleanup +- function cleanup () { +- destroy(stream, true) +- } +- +- // response finished, cleanup +- onFinished(res, cleanup) +- +- // error handling +- stream.on('error', function onerror (err) { +- // clean up stream early +- cleanup() +- +- // error +- self.onStatError(err) +- }) +- +- // end +- stream.on('end', function onend () { +- self.emit('end') +- }) ++ Stream.pipeline(stream, res, err => { if (err) { self.onStatError(err) } else { self.emit('end') } }) ++ ++ // // cleanup ++ // function cleanup () { ++ // destroy(stream, true) ++ // } ++ // ++ // // response finished, cleanup ++ // onFinished(res, cleanup) ++ // ++ // // error handling ++ // stream.on('error', function onerror (err) { ++ // // clean up stream early ++ // cleanup() ++ // ++ // // error ++ // self.onStatError(err) ++ // }) ++ // ++ // // end ++ // stream.on('end', function onend () { ++ // self.emit('end') ++ // }) + } + + /** diff --git a/patches/send+0.17.2.patch b/patches/send+0.17.2.patch new file mode 100644 index 0000000000..1c0b779983 --- /dev/null +++ b/patches/send+0.17.2.patch @@ -0,0 +1,61 @@ +diff --git a/node_modules/send/index.js b/node_modules/send/index.js +index 06d7507..8854216 100644 +--- a/node_modules/send/index.js ++++ b/node_modules/send/index.js +@@ -795,31 +795,31 @@ SendStream.prototype.stream = function stream (path, options) { + // pipe + var stream = fs.createReadStream(path, options) + this.emit('stream', stream) +- stream.pipe(res) +- +- // response finished, done with the fd +- onFinished(res, function onfinished () { +- finished = true +- destroy(stream) +- }) +- +- // error handling code-smell +- stream.on('error', function onerror (err) { +- // request already finished +- if (finished) return +- +- // clean up stream +- finished = true +- destroy(stream) +- +- // error +- self.onStatError(err) +- }) +- +- // end +- stream.on('end', function onend () { +- self.emit('end') +- }) ++ Stream.pipeline(stream, res, err => { if (err) { self.onStatError(err) } else { self.emit('end') } }) ++ ++ // // response finished, done with the fd ++ // onFinished(res, function onfinished () { ++ // finished = true ++ // destroy(stream) ++ // }) ++ // ++ // // error handling code-smell ++ // stream.on('error', function onerror (err) { ++ // // request already finished ++ // if (finished) return ++ // ++ // // clean up stream ++ // finished = true ++ // destroy(stream) ++ // ++ // // error ++ // self.onStatError(err) ++ // }) ++ // ++ // // end ++ // stream.on('end', function onend () { ++ // self.emit('end') ++ // }) + } + + /**