@@ -102,7 +102,6 @@ function OutgoingMessage() {
102102 this [ kIsCorked ] = false ;
103103
104104 this . socket = null ;
105- this . connection = null ;
106105 this . _header = null ;
107106 this [ kOutHeaders ] = null ;
108107
@@ -157,6 +156,15 @@ Object.defineProperty(OutgoingMessage.prototype, '_headers', {
157156 } , 'OutgoingMessage.prototype._headers is deprecated' , 'DEP0066' )
158157} ) ;
159158
159+ Object . defineProperty ( OutgoingMessage . prototype , 'connection' , {
160+ get : function ( ) {
161+ return this . socket ;
162+ } ,
163+ set : function ( val ) {
164+ this . socket = val ;
165+ }
166+ } ) ;
167+
160168Object . defineProperty ( OutgoingMessage . prototype , '_headerNames' , {
161169 get : internalUtil . deprecate ( function ( ) {
162170 const headers = this [ kOutHeaders ] ;
@@ -273,7 +281,7 @@ OutgoingMessage.prototype._send = function _send(data, encoding, callback) {
273281
274282OutgoingMessage . prototype . _writeRaw = _writeRaw ;
275283function _writeRaw ( data , encoding , callback ) {
276- const conn = this . connection ;
284+ const conn = this . socket ;
277285 if ( conn && conn . destroyed ) {
278286 // The socket was destroyed. If we're still trying to write to it,
279287 // then we haven't gotten the 'close' event yet.
@@ -615,10 +623,10 @@ function write_(msg, chunk, encoding, callback, fromEnd) {
615623 [ 'string' , 'Buffer' ] , chunk ) ;
616624 }
617625
618- if ( ! fromEnd && msg . connection && ! msg [ kIsCorked ] ) {
619- msg . connection . cork ( ) ;
626+ if ( ! fromEnd && msg . socket && ! msg [ kIsCorked ] ) {
627+ msg . socket . cork ( ) ;
620628 msg [ kIsCorked ] = true ;
621- process . nextTick ( connectionCorkNT , msg , msg . connection ) ;
629+ process . nextTick ( connectionCorkNT , msg , msg . socket ) ;
622630 }
623631
624632 var len , ret ;
@@ -706,8 +714,8 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
706714 else
707715 this . _contentLength = chunk . length ;
708716 }
709- if ( this . connection ) {
710- this . connection . cork ( ) ;
717+ if ( this . socket ) {
718+ this . socket . cork ( ) ;
711719 uncork = true ;
712720 }
713721 write_ ( this , chunk , encoding , null , true ) ;
@@ -729,16 +737,16 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
729737 }
730738
731739 if ( uncork )
732- this . connection . uncork ( ) ;
740+ this . socket . uncork ( ) ;
733741
734742 this . finished = true ;
735743
736744 // There is the first message on the outgoing queue, and we've sent
737745 // everything to the socket.
738746 debug ( 'outgoing message end.' ) ;
739747 if ( this . outputData . length === 0 &&
740- this . connection &&
741- this . connection . _httpMessage === this ) {
748+ this . socket &&
749+ this . socket . _httpMessage === this ) {
742750 this . _finish ( ) ;
743751 }
744752
@@ -747,7 +755,7 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
747755
748756
749757OutgoingMessage . prototype . _finish = function _finish ( ) {
750- assert ( this . connection ) ;
758+ assert ( this . socket ) ;
751759 this . emit ( 'prefinish' ) ;
752760} ;
753761
0 commit comments