|
@ -239,7 +239,7 @@ function _storeHeader(firstLine, headers) { |
|
|
this.upgrading = true; |
|
|
this.upgrading = true; |
|
|
|
|
|
|
|
|
// Date header
|
|
|
// Date header
|
|
|
if (this.sendDate === true && state.sentDateHeader === false) { |
|
|
if (this.sendDate && !state.sentDateHeader) { |
|
|
state.messageHeader += 'Date: ' + utcDate() + CRLF; |
|
|
state.messageHeader += 'Date: ' + utcDate() + CRLF; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -255,8 +255,7 @@ function _storeHeader(firstLine, headers) { |
|
|
// of creating security liabilities, so suppress the zero chunk and force
|
|
|
// of creating security liabilities, so suppress the zero chunk and force
|
|
|
// the connection to close.
|
|
|
// the connection to close.
|
|
|
var statusCode = this.statusCode; |
|
|
var statusCode = this.statusCode; |
|
|
if ((statusCode === 204 || statusCode === 304) && |
|
|
if ((statusCode === 204 || statusCode === 304) && this.chunkedEncoding) { |
|
|
this.chunkedEncoding === true) { |
|
|
|
|
|
debug(statusCode + ' response should not use chunked encoding,' + |
|
|
debug(statusCode + ' response should not use chunked encoding,' + |
|
|
' closing connection.'); |
|
|
' closing connection.'); |
|
|
this.chunkedEncoding = false; |
|
|
this.chunkedEncoding = false; |
|
@ -267,7 +266,7 @@ function _storeHeader(firstLine, headers) { |
|
|
if (this._removedHeader.connection) { |
|
|
if (this._removedHeader.connection) { |
|
|
this._last = true; |
|
|
this._last = true; |
|
|
this.shouldKeepAlive = false; |
|
|
this.shouldKeepAlive = false; |
|
|
} else if (state.sentConnectionHeader === false) { |
|
|
} else if (!state.sentConnectionHeader) { |
|
|
var shouldSendKeepAlive = this.shouldKeepAlive && |
|
|
var shouldSendKeepAlive = this.shouldKeepAlive && |
|
|
(state.sentContentLengthHeader || |
|
|
(state.sentContentLengthHeader || |
|
|
this.useChunkedEncodingByDefault || |
|
|
this.useChunkedEncodingByDefault || |
|
@ -280,8 +279,7 @@ function _storeHeader(firstLine, headers) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (state.sentContentLengthHeader === false && |
|
|
if (!state.sentContentLengthHeader && !state.sentTransferEncodingHeader) { |
|
|
state.sentTransferEncodingHeader === false) { |
|
|
|
|
|
if (!this._hasBody) { |
|
|
if (!this._hasBody) { |
|
|
// Make sure we don't end the 0\r\n\r\n at the end of the message.
|
|
|
// Make sure we don't end the 0\r\n\r\n at the end of the message.
|
|
|
this.chunkedEncoding = false; |
|
|
this.chunkedEncoding = false; |
|
|