summaryrefslogtreecommitdiff
path: root/lib/https.js
diff options
context:
space:
mode:
authorDmitry Nizovtsev <dmitry@ukrteam.com>2012-02-23 17:37:49 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2012-03-06 13:35:49 +0100
commit1e9bcf26ce9e93caeda3280b8186168b49ae621d (patch)
tree481e3128ce49e1151e9ae60cdadf5aa01fa9449b /lib/https.js
parent9ea5a4c468fe290f00b6ebc78c33c2a60cc53625 (diff)
downloadandroid-node-v8-1e9bcf26ce9e93caeda3280b8186168b49ae621d.tar.gz
android-node-v8-1e9bcf26ce9e93caeda3280b8186168b49ae621d.tar.bz2
android-node-v8-1e9bcf26ce9e93caeda3280b8186168b49ae621d.zip
net, http, https: add localAddress option
Binds to a local address before making the outgoing connection.
Diffstat (limited to 'lib/https.js')
-rw-r--r--lib/https.js24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/https.js b/lib/https.js
index 640de1dd00..9778354007 100644
--- a/lib/https.js
+++ b/lib/https.js
@@ -51,12 +51,30 @@ exports.createServer = function(opts, requestListener) {
// HTTPS agents.
-function createConnection(port, host, options) {
- options.port = port;
- options.host = host;
+function createConnection(/* [port, host, options] */) {
+ var options = {};
+
+ if (typeof arguments[0] === 'object') {
+ options = arguments[0];
+ } else if (typeof arguments[1] === 'object') {
+ options = arguments[1];
+ options.port = arguments[0];
+ } else if (typeof arguments[2] === 'object') {
+ options = arguments[2];
+ options.port = arguments[0];
+ options.host = arguments[1];
+ } else {
+ if (typeof arguments[0] === 'number') {
+ options.port = arguments[0];
+ }
+ if (typeof arguments[1] === 'string') {
+ options.host = arguments[1];
+ }
+ }
return tls.connect(options);
}
+
function Agent(options) {
http.Agent.call(this, options);
this.createConnection = createConnection;