Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
http: use CRLF conistently in _http_outgoing.js
PR-URL: #37851
Reviewed-By: Zeyu Yang <himself65@outlook.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Loading branch information
Showing
1 changed file
with
6 additions
and
6 deletions .
+6
−6
lib/_http_outgoing.js
@@ -502,14 +502,14 @@ function _storeHeader(firstLine, headers) {
const shouldSendKeepAlive = this . shouldKeepAlive &&
( state . contLen || this . useChunkedEncodingByDefault || this . agent ) ;
if ( shouldSendKeepAlive ) {
header += 'Connection: keep-alive\r\n' ;
header += 'Connection: keep-alive' + CRLF ;
if ( this . _keepAliveTimeout && this . _defaultKeepAlive ) {
const timeoutSeconds = MathFloor ( this . _keepAliveTimeout / 1000 ) ;
header += `Keep-Alive: timeout=${ timeoutSeconds } \r\n ` ;
header += `Keep-Alive: timeout=${ timeoutSeconds } ${ CRLF } ` ;
}
} else {
this . _last = true ;
header += 'Connection: close\r\n' ;
header += 'Connection: close' + CRLF ;
}
}
@@ -525,7 +525,7 @@ function _storeHeader(firstLine, headers) {
typeof this . _contentLength === 'number' ) {
header += 'Content-Length: ' + this . _contentLength + CRLF ;
} else if ( ! this . _removedTE ) {
header += 'Transfer-Encoding: chunked\r\n' ;
header += 'Transfer-Encoding: chunked' + CRLF ;
this . chunkedEncoding = true ;
} else {
// We should only be able to get here if both Content-Length and
@@ -740,7 +740,7 @@ ObjectDefineProperty(OutgoingMessage.prototype, 'headersSent', {
get : function ( ) { return ! ! this . _header ; }
} ) ;
const crlf_buf = Buffer . from ( '\r\n' ) ;
const crlf_buf = Buffer . from ( CRLF ) ;
OutgoingMessage . prototype . write = function write ( chunk , encoding , callback ) {
if ( typeof encoding === 'function' ) {
callback = encoding ;
@@ -903,7 +903,7 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) {
state . finalCalled = true ;
if ( this . _hasBody && this . chunkedEncoding ) {
this . _send ( '0\r\n ' + this . _trailer + '\r\n' , 'latin1' , finish ) ;
this . _send ( '0' + CRLF + this . _trailer + CRLF , 'latin1' , finish ) ;
} else {
// Force a flush, HACK.
this . _send ( '' , 'latin1' , finish ) ;
Toggle all file notes
Toggle all file annotations