@@ -40,7 +40,7 @@ function utcDate() {
40
40
}
41
41
return dateCache ;
42
42
}
43
- utcDate . _onTimeout = function ( ) {
43
+ utcDate . _onTimeout = function _onTimeout ( ) {
44
44
dateCache = undefined ;
45
45
} ;
46
46
@@ -91,7 +91,7 @@ util.inherits(OutgoingMessage, Stream);
91
91
exports . OutgoingMessage = OutgoingMessage ;
92
92
93
93
94
- OutgoingMessage . prototype . setTimeout = function ( msecs , callback ) {
94
+ OutgoingMessage . prototype . setTimeout = function setTimeout ( msecs , callback ) {
95
95
96
96
if ( callback ) {
97
97
this . on ( 'timeout' , callback ) ;
@@ -111,7 +111,7 @@ OutgoingMessage.prototype.setTimeout = function(msecs, callback) {
111
111
// It's possible that the socket will be destroyed, and removed from
112
112
// any messages, before ever calling this. In that case, just skip
113
113
// it, since something else is destroying this connection anyway.
114
- OutgoingMessage . prototype . destroy = function ( error ) {
114
+ OutgoingMessage . prototype . destroy = function destroy ( error ) {
115
115
if ( this . socket )
116
116
this . socket . destroy ( error ) ;
117
117
else
@@ -122,7 +122,7 @@ OutgoingMessage.prototype.destroy = function(error) {
122
122
123
123
124
124
// This abstract either writing directly to the socket or buffering it.
125
- OutgoingMessage . prototype . _send = function ( data , encoding , callback ) {
125
+ OutgoingMessage . prototype . _send = function _send ( data , encoding , callback ) {
126
126
// This is a shameful hack to get the headers and first body chunk onto
127
127
// the same packet. Future versions of Node are going to take care of
128
128
// this at a lower level and in a more general way.
@@ -145,7 +145,8 @@ OutgoingMessage.prototype._send = function(data, encoding, callback) {
145
145
} ;
146
146
147
147
148
- OutgoingMessage . prototype . _writeRaw = function ( data , encoding , callback ) {
148
+ OutgoingMessage . prototype . _writeRaw = _writeRaw ;
149
+ function _writeRaw ( data , encoding , callback ) {
149
150
if ( typeof encoding === 'function' ) {
150
151
callback = encoding ;
151
152
encoding = null ;
@@ -176,10 +177,10 @@ OutgoingMessage.prototype._writeRaw = function(data, encoding, callback) {
176
177
// buffer, as long as we're not destroyed.
177
178
return this . _buffer ( data , encoding , callback ) ;
178
179
}
179
- } ;
180
+ }
180
181
181
182
182
- OutgoingMessage . prototype . _buffer = function ( data , encoding , callback ) {
183
+ OutgoingMessage . prototype . _buffer = function _buffer ( data , encoding , callback ) {
183
184
this . output . push ( data ) ;
184
185
this . outputEncodings . push ( encoding ) ;
185
186
this . outputCallbacks . push ( callback ) ;
@@ -190,7 +191,8 @@ OutgoingMessage.prototype._buffer = function(data, encoding, callback) {
190
191
} ;
191
192
192
193
193
- OutgoingMessage . prototype . _storeHeader = function ( firstLine , headers ) {
194
+ OutgoingMessage . prototype . _storeHeader = _storeHeader ;
195
+ function _storeHeader ( firstLine , headers ) {
194
196
// firstLine in the case of request is: 'GET /index.html HTTP/1.1\r\n'
195
197
// in the case of response it is: 'HTTP/1.1 200 OK\r\n'
196
198
var state = {
@@ -307,7 +309,7 @@ OutgoingMessage.prototype._storeHeader = function(firstLine, headers) {
307
309
// wait until the first body chunk, or close(), is sent to flush,
308
310
// UNLESS we're sending Expect: 100-continue.
309
311
if ( state . sentExpect ) this . _send ( '' ) ;
310
- } ;
312
+ }
311
313
312
314
function storeHeader ( self , state , field , value ) {
313
315
if ( ! common . _checkIsHttpToken ( field ) ) {
@@ -346,7 +348,7 @@ function storeHeader(self, state, field, value) {
346
348
}
347
349
348
350
349
- OutgoingMessage . prototype . setHeader = function ( name , value ) {
351
+ OutgoingMessage . prototype . setHeader = function setHeader ( name , value ) {
350
352
if ( ! common . _checkIsHttpToken ( name ) )
351
353
throw new TypeError (
352
354
'Header name must be a valid HTTP Token ["' + name + '"]' ) ;
@@ -369,7 +371,7 @@ OutgoingMessage.prototype.setHeader = function(name, value) {
369
371
} ;
370
372
371
373
372
- OutgoingMessage . prototype . getHeader = function ( name ) {
374
+ OutgoingMessage . prototype . getHeader = function getHeader ( name ) {
373
375
if ( arguments . length < 1 ) {
374
376
throw new Error ( '"name" argument is required for getHeader(name)' ) ;
375
377
}
@@ -381,7 +383,7 @@ OutgoingMessage.prototype.getHeader = function(name) {
381
383
} ;
382
384
383
385
384
- OutgoingMessage . prototype . removeHeader = function ( name ) {
386
+ OutgoingMessage . prototype . removeHeader = function removeHeader ( name ) {
385
387
if ( arguments . length < 1 ) {
386
388
throw new Error ( '"name" argument is required for removeHeader(name)' ) ;
387
389
}
@@ -404,7 +406,7 @@ OutgoingMessage.prototype.removeHeader = function(name) {
404
406
} ;
405
407
406
408
407
- OutgoingMessage . prototype . _renderHeaders = function ( ) {
409
+ OutgoingMessage . prototype . _renderHeaders = function _renderHeaders ( ) {
408
410
if ( this . _header ) {
409
411
throw new Error ( 'Can\'t render headers after they are sent to the client' ) ;
410
412
}
@@ -423,7 +425,7 @@ OutgoingMessage.prototype._renderHeaders = function() {
423
425
return headers ;
424
426
} ;
425
427
426
- OutgoingMessage . prototype . _implicitHeader = function ( ) {
428
+ OutgoingMessage . prototype . _implicitHeader = function _implicitHeader ( ) {
427
429
throw new Error ( '_implicitHeader() method is not implemented' ) ;
428
430
} ;
429
431
@@ -434,7 +436,7 @@ Object.defineProperty(OutgoingMessage.prototype, 'headersSent', {
434
436
} ) ;
435
437
436
438
437
- OutgoingMessage . prototype . write = function ( chunk , encoding , callback ) {
439
+ OutgoingMessage . prototype . write = function write ( chunk , encoding , callback ) {
438
440
if ( this . finished ) {
439
441
var err = new Error ( 'write after end' ) ;
440
442
process . nextTick ( writeAfterEndNT , this , err , callback ) ;
@@ -513,7 +515,7 @@ function escapeHeaderValue(value) {
513
515
}
514
516
515
517
516
- OutgoingMessage . prototype . addTrailers = function ( headers ) {
518
+ OutgoingMessage . prototype . addTrailers = function addTrailers ( headers ) {
517
519
this . _trailer = '' ;
518
520
var keys = Object . keys ( headers ) ;
519
521
var isArray = Array . isArray ( headers ) ;
@@ -542,7 +544,7 @@ OutgoingMessage.prototype.addTrailers = function(headers) {
542
544
const crlf_buf = Buffer . from ( '\r\n' ) ;
543
545
544
546
545
- OutgoingMessage . prototype . end = function ( data , encoding , callback ) {
547
+ OutgoingMessage . prototype . end = function end ( data , encoding , callback ) {
546
548
if ( typeof data === 'function' ) {
547
549
callback = data ;
548
550
data = null ;
@@ -618,7 +620,7 @@ OutgoingMessage.prototype.end = function(data, encoding, callback) {
618
620
} ;
619
621
620
622
621
- OutgoingMessage . prototype . _finish = function ( ) {
623
+ OutgoingMessage . prototype . _finish = function _finish ( ) {
622
624
assert ( this . connection ) ;
623
625
this . emit ( 'prefinish' ) ;
624
626
} ;
@@ -643,7 +645,7 @@ OutgoingMessage.prototype._finish = function() {
643
645
//
644
646
// This function, outgoingFlush(), is called by both the Server and Client
645
647
// to attempt to flush any pending messages out to the socket.
646
- OutgoingMessage . prototype . _flush = function ( ) {
648
+ OutgoingMessage . prototype . _flush = function _flush ( ) {
647
649
var socket = this . socket ;
648
650
var ret ;
649
651
@@ -688,7 +690,7 @@ OutgoingMessage.prototype._flushOutput = function _flushOutput(socket) {
688
690
} ;
689
691
690
692
691
- OutgoingMessage . prototype . flushHeaders = function ( ) {
693
+ OutgoingMessage . prototype . flushHeaders = function flushHeaders ( ) {
692
694
if ( ! this . _header ) {
693
695
this . _implicitHeader ( ) ;
694
696
}
0 commit comments