Skip to content

Commit

Permalink
destroy the file stream if the response closes
Browse files Browse the repository at this point in the history
  • Loading branch information
mafintosh committed Apr 14, 2015
1 parent 04587b3 commit cb2cd60
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/ecstatic.js
Expand Up @@ -187,6 +187,9 @@ var ecstatic = module.exports = function (dir, options) {
fstream.on('error', function (err) {
status['500'](res, next, { error: err });
});
res.on('close', function () {
fstream.destroy();
});
res.writeHead(206, {
'Content-Range': 'bytes ' + start + '-' + end + '/' + total,
'Accept-Ranges': 'bytes',
Expand Down

0 comments on commit cb2cd60

Please sign in to comment.