Skip to content
Myr

Fixed bug messing with error handlers when listenFD() is called instead of listen(). [thanks guillermo]

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

programs such as "spark" call listenFD() to call listen(1) with a file descriptor, BUT Express was only proxying listen() to register these handlers. Thanks for catching this bug guillermo!

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent 5add7cb · Browse files · 1 file+23 added−7 removed
This commit

State

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

Diff stats

1 file+23 added−7 removed

  • other:+23 added−7 removed

1 file+23 added−7 removed

modified:lib/express/server.js+23 added-7 removed
71 unmodified lines
7273sys.inherits(Server, connect.Server);7475/**76 * Stack error handler callbacks, then listen on the given77 * `port` and `host`.76 * Proxy in order to register error handlers;77 */7879Server.prototype.listen = function(){80 this.registerErrorHandlers();81 connect.Server.prototype.listen.apply(this, arguments);82};8384/**85 * Proxy in order to register error handlers;86 */8788Server.prototype.listenFD = function(){89 this.registerErrorHandlers();90 connect.Server.prototype.listenFD.apply(this, arguments);91};9293/**94 * Register error handlers. This is automatically95 * called from within `Server#listen()` and `Server#listenFD()`.96 *79 * @param {Number|String} port80 * @param {String} host81 * @return {Type}97 * @return {Server} for chaining98 * @api public99 */10085Server.prototype.listen = function(){101Server.prototype.registerErrorHandlers = function(){102 this.errorHandlers.forEach(function(fn){103 this.use(function(err, req, res, next){104 fn.apply(this, arguments);105 });106 }, this);91 connect.Server.prototype.listen.apply(this, arguments);107 return this;108};109110/**111 * Proxy `connect.Server#use()` to apply settings to
196 unmodified lines