Skip to content

Commit 85fe05e

Browse files
sam-githubMylesBorins
authored andcommitted
tls: fix/annotate connect arg comments
PR-URL: #9800 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent db65483 commit 85fe05e

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎lib/_tls_wrap.js‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,11 @@ function normalizeConnectArgs(listArgs) {
975975
varoptions=args[0];
976976
varcb=args[1];
977977

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

987-
exports.connect=function(/* [port,host], options, cb */){
992+
exports.connect=function(/* [port,] [host,] [options,] [cb] */){
988993
constargsLen=arguments.length;
989994
varargs=newArray(argsLen);
990995
for(vari=0;i<argsLen;i++)

0 commit comments

Comments
 (0)