Skip to content

Commit 8e4b9fa

Browse files
sam-githubitaloacasas
authored andcommitted
tls: fix/annotate connect arg comments
PR-URL: #9800 Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 980acb4 commit 8e4b9fa

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/_tls_wrap.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -976,6 +976,11 @@ function normalizeConnectArgs(listArgs) {
976976
var options = args[0];
977977
var cb = args[1];
978978

979+
// If args[0] was options, then normalize dealt with it.
980+
// If args[0] is port, or args[0], args[1] is host,port, we need to
981+
// find the options and merge them in, normalize's options has only
982+
// the host/port/path args that it knows about, not the tls options.
983+
// This means that options.host overrides a host arg.
979984
if (listArgs[1] !== null && typeof listArgs[1] === 'object') {
980985
options = util._extend(options, listArgs[1]);
981986
} else if (listArgs[2] !== null && typeof listArgs[2] === 'object') {
@@ -985,7 +990,7 @@ function normalizeConnectArgs(listArgs) {
985990
return (cb) ? [options, cb] : [options];
986991
}
987992

988-
exports.connect = function(/* [port, host], options, cb */) {
993+
exports.connect = function(/* [port,] [host,] [options,] [cb] */) {
989994
const argsLen = arguments.length;
990995
var args = new Array(argsLen);
991996
for (var i = 0; i < argsLen; i++)

0 commit comments

Comments
 (0)