@@ -100,7 +100,6 @@ function OutgoingMessage() {
100100 this [ kIsCorked ] = false ;
101101
102102 this . socket = null ;
103- this . connection = null ;
104103 this . _header = null ;
105104 this [ outHeadersKey ] = null ;
106105
@@ -137,6 +136,15 @@ Object.defineProperty(OutgoingMessage.prototype, '_headers', {
137136 } , 'OutgoingMessage.prototype._headers is deprecated' , 'DEP0066' )
138137} ) ;
139138
139+ Object . defineProperty ( OutgoingMessage . prototype , 'connection' , {
140+ get : function ( ) {
141+ return this . socket ;
142+ } ,
143+ set : function ( val ) {
144+ this . socket = val ;
145+ }
146+ } ) ;
147+
140148Object . defineProperty ( OutgoingMessage . prototype , '_headerNames' , {
141149 get : internalUtil . deprecate ( function ( ) {
142150 const headers = this [ outHeadersKey ] ;
@@ -253,7 +261,7 @@ OutgoingMessage.prototype._send = function _send(data, encoding, callback) {
253261
254262OutgoingMessage . prototype . _writeRaw = _writeRaw ;
255263function _writeRaw ( data , encoding , callback ) {
256- const conn = this . connection ;
264+ const conn = this . socket ;
257265 if ( conn && conn . destroyed ) {
258266 // The socket was destroyed. If we're still trying to write to it,
259267 // then we haven't gotten the 'close' event yet.
@@ -591,10 +599,10 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
591599 [ 'string' , 'Buffer' ] , chunk ) ;
592600 }
593601
594- if ( ! fromEnd && msg . connection && ! msg [ kIsCorked ] ) {
595- msg . connection . cork ( ) ;
602+ if ( ! fromEnd && msg . socket && ! msg [ kIsCorked ] ) {
603+ msg . socket . cork ( ) ;
596604 msg [ kIsCorked ] = true ;
597- process . nextTick ( connectionCorkNT , msg , msg . connection ) ;
605+ process . nextTick ( connectionCorkNT , msg , msg . socket ) ;
598606 }
599607
600608 var len , ret ;
@@ -682,8 +690,8 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
682690 else
683691 this . _contentLength = chunk . length ;
684692 }
685- if ( this . connection ) {
686- this . connection . cork ( ) ;
693+ if ( this . socket ) {
694+ this . socket . cork ( ) ;
687695 uncork = true ;
688696 }
689697 write_ ( this , chunk , encoding , null , true ) ;
@@ -705,16 +713,16 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
705713 }
706714
707715 if ( uncork )
708- this . connection . uncork ( ) ;
716+ this . socket . uncork ( ) ;
709717
710718 this . finished = true ;
711719
712720 // There is the first message on the outgoing queue, and we've sent
713721 // everything to the socket.
714722 debug ( 'outgoing message end.' ) ;
715723 if ( this . outputData . length === 0 &&
716- this . connection &&
717- this . connection . _httpMessage === this ) {
724+ this . socket &&
725+ this . socket . _httpMessage === this ) {
718726 this . _finish ( ) ;
719727 }
720728
@@ -723,7 +731,7 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
723731
724732
725733OutgoingMessage . prototype . _finish = function _finish ( ) {
726- assert ( this . connection ) ;
734+ assert ( this . socket ) ;
727735 this . emit ( 'prefinish' ) ;
728736} ;
729737
0 commit comments