Skip to content
Myr

Fix res.sendFile logging standard write errors

Before adoption: this commit came in with the history the project adopted, so no landing records it.

closes #2451

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 7fcc8b1 · Browse files · 3 files+28 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+28 added−2 removed

  • tests:+21 added−0 removed
  • other:+7 added−2 removed

3 files+28 added−2 removed

modified:lib/response.js+2 added-2 removed
465 unmodified lines
466 sendfile(res, file, options, function (err) {467 if (fn) return fn(err);468 if (err && err.code === 'EISDIR') return next();469470 // next() all but aborted errors471 if (err && err.code !== 'ECONNABORT') {470 // next() all but write errors471 if (err && err.code !== 'ECONNABORT' && err.syscall !== 'write') {472 next(err);473 }474 });475};
496 unmodified lines
modified:test/res.sendFile.js+21 added
474 unmodified lines
475 .get('/')476 .expect(200, '20%', done);477 });478479 it('should not error if the client aborts', function (done) {480 var cb = after(1, done);481 var app = express();482483 app.use(function (req, res) {484 setImmediate(function () {485 res.sendfile(path.resolve(fixtures, 'name.txt'));486 cb();487 });488 test.abort();489 });490491 app.use(function (err, req, res, next) {492 err.code.should.be.empty;493 cb();494 });495496 var test = request(app).get('/');497 test.expect(200, cb);498 })499500 describe('with an absolute path', function(){501 it('should transfer the file', function(done){502 var app = express();503
136 unmodified lines
modified:History.md+5 added
1unreleased2==========34 * Fix `res.sendfile` logging standard write errors564.10.3 / 2014-11-237===================89 * Fix `res.sendFile` logging standard write errors
2488 unmodified lines