@@ -45,9 +45,12 @@ const Stream = require('stream');
4545const internalUtil = require ( 'internal/util' ) ;
4646const { kOutHeaders, utcDate, kNeedDrain } = require ( 'internal/http' ) ;
4747const { Buffer } = require ( 'buffer' ) ;
48- const common = require ( '_http_common' ) ;
49- const checkIsHttpToken = common . _checkIsHttpToken ;
50- const checkInvalidHeaderChar = common . _checkInvalidHeaderChar ;
48+ const {
49+ _checkIsHttpToken : checkIsHttpToken ,
50+ _checkInvalidHeaderChar : checkInvalidHeaderChar ,
51+ chunkExpression : RE_TE_CHUNKED ,
52+ CRLF
53+ } = require ( '_http_common' ) ;
5154const {
5255 defaultTriggerAsyncIdScope,
5356 symbols : { async_id_symbol }
@@ -78,14 +81,12 @@ let debug = require('internal/util/debuglog').debuglog('http', (fn) => {
7881} ) ;
7982
8083const HIGH_WATER_MARK = getDefaultHighWaterMark ( ) ;
81- const { CRLF } = common ;
8284
8385const kCorked = Symbol ( 'corked' ) ;
8486
8587const nop = ( ) => { } ;
8688
8789const RE_CONN_CLOSE = / (?: ^ | \W ) c l o s e (?: $ | \W ) / i;
88- const RE_TE_CHUNKED = common . chunkExpression ;
8990
9091// isCookieField performs a case-insensitive comparison of a provided string
9192// against the word "cookie." As of V8 6.6 this is faster than handrolling or
@@ -874,7 +875,7 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
874875 const finish = onFinish . bind ( undefined , this ) ;
875876
876877 if ( this . _hasBody && this . chunkedEncoding ) {
877- this . _send ( '0\r\n ' + this . _trailer + '\r\n' , 'latin1' , finish ) ;
878+ this . _send ( '0' + CRLF + this . _trailer + CRLF , 'latin1' , finish ) ;
878879 } else {
879880 // Force a flush, HACK.
880881 this . _send ( '' , 'latin1' , finish ) ;
0 commit comments