http/https: pass request to .createConnection()

It's useful for passing some additional options of request object to the
underlying API
This commit is contained in:
Fedor Indutny
2012-07-11 23:53:27 +04:00
parent 1fa0bca2ad
commit 53716eb0b5
2 changed files with 19 additions and 11 deletions

View File

@@ -21,7 +21,8 @@
var tls = require('tls');
var http = require('http');
var inherits = require('util').inherits;
var util = require('util');
var inherits = util.inherits;
function Server(opts, requestListener) {
if (!(this instanceof Server)) return new Server(opts, requestListener);
@@ -52,15 +53,15 @@ exports.createServer = function(opts, requestListener) {
// HTTPS agents.
function createConnection(/* [port, host, options] */) {
var options = {};
var options = util._extend({}, this.options);
if (typeof arguments[0] === 'object') {
options = arguments[0];
options = util._extend(options, arguments[0]);
} else if (typeof arguments[1] === 'object') {
options = arguments[1];
options = util._extend(options, arguments[1]);
options.port = arguments[0];
} else if (typeof arguments[2] === 'object') {
options = arguments[2];
options = util._extend(options, arguments[2]);
options.port = arguments[0];
options.host = arguments[1];
} else {