From b9a994fcae06501f9e247413b94c548c53711a72 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Thu, 11 Apr 2019 14:25:14 +0200 Subject: [PATCH] fix: leak on res aborted on non-range requests --- lib/ecstatic.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ecstatic.js b/lib/ecstatic.js index 835fd8d..7522e65 100644 --- a/lib/ecstatic.js +++ b/lib/ecstatic.js @@ -344,6 +344,9 @@ module.exports = function createMiddleware(_dir, _options) { stream.on('error', (err) => { status['500'](res, next, { error: err }); }); + res.on('close', () => { + stream.destroy(); + }); }