Skip to content

Commit 690fc56

Browse files
Fix #85 "port argument must be >= 0 and < 65536"
1 parent 9c869bb commit 690fc56

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/proxy.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,13 @@ Proxy.prototype._createHttpsServer = function (options, callback) {
9898
httpsServer.on('request', this._onHttpServerRequest.bind(this, true));
9999
var wssServer = new WebSocket.Server({ server: httpsServer });
100100
wssServer.on('connection', this._onWebSocketServerConnect.bind(this, true));
101-
httpsServer.listen(this.httpsPort || undefined, function() {
101+
var listenArgs = [function() {
102102
if (callback) callback(httpsServer.address().port, httpsServer, wssServer);
103-
});
103+
}];
104+
if (this.httpsPort) {
105+
listenArgs.unshift(this.httpsPort);
106+
}
107+
httpsServer.listen.apply(httpsServer, listenArgs);
104108
};
105109

106110
Proxy.prototype.close = function () {

0 commit comments

Comments
 (0)