diff options
author | Brian White <mscdex@mscdex.net> | 2016-12-20 02:50:34 -0500 |
---|---|---|
committer | Brian White <mscdex@mscdex.net> | 2016-12-29 14:19:10 -0500 |
commit | af74e72a9f163659865f835d313f5e532956e077 (patch) | |
tree | adaa27fc17e64567dd11d51d7e19885d922f747d /lib/_http_outgoing.js | |
parent | e8b809a7a0c8eeb41bd1904bafeba0884cf4c265 (diff) | |
download | android-node-v8-af74e72a9f163659865f835d313f5e532956e077.tar.gz android-node-v8-af74e72a9f163659865f835d313f5e532956e077.tar.bz2 android-node-v8-af74e72a9f163659865f835d313f5e532956e077.zip |
http: simplify boolean checks
PR-URL: https://github.com/nodejs/node/pull/6533
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'lib/_http_outgoing.js')
-rw-r--r-- | lib/_http_outgoing.js | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/_http_outgoing.js b/lib/_http_outgoing.js index 1e612316f4..262b1d9f87 100644 --- a/lib/_http_outgoing.js +++ b/lib/_http_outgoing.js @@ -239,7 +239,7 @@ function _storeHeader(firstLine, headers) { this.upgrading = true; // Date header - if (this.sendDate === true && state.sentDateHeader === false) { + if (this.sendDate && !state.sentDateHeader) { state.messageHeader += 'Date: ' + utcDate() + CRLF; } @@ -255,8 +255,7 @@ function _storeHeader(firstLine, headers) { // of creating security liabilities, so suppress the zero chunk and force // the connection to close. var statusCode = this.statusCode; - if ((statusCode === 204 || statusCode === 304) && - this.chunkedEncoding === true) { + if ((statusCode === 204 || statusCode === 304) && this.chunkedEncoding) { debug(statusCode + ' response should not use chunked encoding,' + ' closing connection.'); this.chunkedEncoding = false; @@ -267,7 +266,7 @@ function _storeHeader(firstLine, headers) { if (this._removedHeader.connection) { this._last = true; this.shouldKeepAlive = false; - } else if (state.sentConnectionHeader === false) { + } else if (!state.sentConnectionHeader) { var shouldSendKeepAlive = this.shouldKeepAlive && (state.sentContentLengthHeader || this.useChunkedEncodingByDefault || @@ -280,8 +279,7 @@ function _storeHeader(firstLine, headers) { } } - if (state.sentContentLengthHeader === false && - state.sentTransferEncodingHeader === false) { + if (!state.sentContentLengthHeader && !state.sentTransferEncodingHeader) { if (!this._hasBody) { // Make sure we don't end the 0\r\n\r\n at the end of the message. this.chunkedEncoding = false; |