summaryrefslogtreecommitdiffhomepage
path: root/src/nodejs
diff options
context:
space:
mode:
Diffstat (limited to 'src/nodejs')
-rwxr-xr-xsrc/nodejs/unit-http/http_server.js18
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() {