@@ -929,7 +929,7 @@ Agent.prototype.addRequest = function(req, host, port) {
929929} ;
930930Agent . prototype . createSocket = function ( name , host , port ) {
931931 var self = this ;
932- var s = self . createConnection ( port , host ) ;
932+ var s = self . createConnection ( port , host , self . options ) ;
933933 if ( ! self . sockets [ name ] ) {
934934 self . sockets [ name ] = [ ] ;
935935 }
@@ -1027,7 +1027,11 @@ function ClientRequest(options, cb) {
10271027 if ( self . socketPath ) {
10281028 self . _last = true ;
10291029 self . shouldKeepAlive = false ;
1030- self . onSocket ( net . createConnection ( self . socketPath ) ) ;
1030+ if ( options . createConnection ) {
1031+ self . onSocket ( options . createConnection ( self . socketPath ) ) ;
1032+ } else {
1033+ self . onSocket ( net . createConnection ( self . socketPath ) ) ;
1034+ }
10311035 } else if ( self . agent ) {
10321036 // If there is an agent we should default to Connection:keep-alive.
10331037 self . _last = false ;
@@ -1037,7 +1041,11 @@ function ClientRequest(options, cb) {
10371041 // No agent, default to Connection:close.
10381042 self . _last = true ;
10391043 self . shouldKeepAlive = false ;
1040- self . onSocket ( net . createConnection ( options . port , options . host ) ) ;
1044+ if ( options . createConnection ) {
1045+ self . onSocket ( options . createConnection ( options . port , options . host , options ) ) ;
1046+ } else {
1047+ self . onSocket ( net . createConnection ( options . port , options . host ) ) ;
1048+ }
10411049 }
10421050
10431051 self . _deferToConnect ( null , null , function ( ) {
0 commit comments