From 4d7154a31a1e228c5ebd83fa9a448e6f2a044b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 3 May 2016 16:03:48 +0200 Subject: [PATCH] app: send port:0 instead of port:undefined Node v6 no longer supports port:undefined, this commit is fixing app.listen() to correctly send port:0 when no port is specified. --- lib/application.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/application.js b/lib/application.js index 5667e0eb..a98bd331 100644 --- a/lib/application.js +++ b/lib/application.js @@ -565,7 +565,11 @@ app.listen = function(cb) { (arguments.length == 1 && typeof arguments[0] == 'function'); if (useAppConfig) { - server.listen(this.get('port'), this.get('host'), cb); + var port = this.get('port'); + // NOTE(bajtos) port:undefined no longer works on node@6, + // we must pass port:0 explicitly + if (port === undefined) port = 0; + server.listen(port, this.get('host'), cb); } else { server.listen.apply(server, arguments); }