diff options
author | Alexander Borisov <alexander.borisov@nginx.com> | 2018-12-19 15:56:09 +0300 |
---|---|---|
committer | Alexander Borisov <alexander.borisov@nginx.com> | 2018-12-19 15:56:09 +0300 |
commit | 704fe556b423795d06f79cec3a3406ef6defb635 (patch) | |
tree | 80e01a7d9b7e7ef8ee8596ef0c531886791e0ac4 /src/nodejs/unit-http/http_server.js | |
parent | dc16885b60f1d31d09114ea6140384531cad78e0 (diff) | |
download | unit-704fe556b423795d06f79cec3a3406ef6defb635.tar.gz unit-704fe556b423795d06f79cec3a3406ef6defb635.tar.bz2 |
Node.js: style fixes.
No functional changes.
Diffstat (limited to 'src/nodejs/unit-http/http_server.js')
-rwxr-xr-x | src/nodejs/unit-http/http_server.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nodejs/unit-http/http_server.js b/src/nodejs/unit-http/http_server.js index 8a536cde..c93d2b10 100755 --- a/src/nodejs/unit-http/http_server.js +++ b/src/nodejs/unit-http/http_server.js @@ -105,21 +105,23 @@ ServerResponse.prototype.removeHeader = function removeHeader(name) { } let name_len = Buffer.byteLength(name + "", 'latin1'); + let value = this.headers[name]; - if (Array.isArray(this.headers[name])) { - this.headers_count -= this.headers[name].length; - this.headers_len -= this.headers[name].length * name_len; + delete this.headers[name]; + + if (Array.isArray(value)) { + this.headers_count -= value.length; + this.headers_len -= value.length * name_len; - this.headers[name].forEach(function(val) { + value.forEach(function(val) { this.headers_len -= Buffer.byteLength(val + "", 'latin1'); }); - } else { - this.headers_count--; - this.headers_len -= name_len + Buffer.byteLength(this.headers[name] + "", 'latin1'); + return; } - delete this.headers[name]; + this.headers_count--; + this.headers_len -= name_len + Buffer.byteLength(value + "", 'latin1'); }; ServerResponse.prototype.sendDate = function sendDate() { |