Browse Source

Fix option parsing in tls.connect()

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
df5d5d6342
  1. 21
      lib/tls.js

21
lib/tls.js

@ -650,30 +650,21 @@ Server.prototype.setOptions = function(options) {
exports.connect = function(port /* host, options, cb */) {
// parse args
var host, options = {}, cb;
switch (typeof arguments[1]) {
for (var i = 1; i < arguments.length; i++) {
switch (typeof arguments[i]) {
case 'string':
host = arguments[1];
if (typeof arguments[2] == 'object') {
options = arguments[2];
if (typeof arguments[3] == 'function') cb = arguments[3];
} else if (typeof arguments[2] == 'function') {
cb = arguments[2];
}
host = arguments[i];
break;
case 'object':
options = arguments[1];
if (typeof arguments[2] == 'function') cb = arguments[2];
options = arguments[i];
break;
case 'function':
cb = arguments[1];
break;
default:
cb = arguments[i];
break;
}
}
var socket = new net.Stream();

Loading…
Cancel
Save