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.

fixes #2433

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 869ddd7 · Browse files · 3 files+24 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+24 added−2 removed

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

3 files+24 added−2 removed

modified:lib/response.js+2 added-2 removed
396 unmodified lines
397 sendfile(res, file, options, function (err) {398 if (fn) return fn(err);399 if (err && err.code === 'EISDIR') return next();400401 // next() all but aborted errors402 if (err && err.code !== 'ECONNABORT') {401 // next() all but write errors402 if (err && err.code !== 'ECONNABORT' && err.syscall !== 'write') {403 next(err);404 }405 });406};
565 unmodified lines
modified:test/res.sendFile.js+21 added
67 unmodified lines
68 .expect('Content-Type', 'application/x-bogus')69 .end(done);70 })7172 it('should not error if the client aborts', function (done) {73 var cb = after(1, done);74 var app = express();7576 app.use(function (req, res) {77 setImmediate(function () {78 res.sendFile(path.resolve(fixtures, 'name.txt'));79 cb();80 });81 test.abort();82 });8384 app.use(function (err, req, res, next) {85 err.code.should.be.empty;86 cb();87 });8889 var test = request(app).get('/');90 test.expect(200, cb);91 })9293 describe('with "dotfiles" option', function () {94 it('should not serve dotfiles by default', function (done) {95 var app = createApp(path.resolve(__dirname, 'fixtures/.name'));96
522 unmodified lines
modified:History.md+1 added
1unreleased2==========34 * Fix `res.sendFile` logging standard write errors5 * deps: etag@~1.5.16 * deps: proxy-addr@~1.0.47 - deps: ipaddr.js@0.1.58 * deps: qs@2.3.3
2484 unmodified lines