Commit 215f24a88df for nodejs
commit 215f24a88dfcb1fdd099a3560e46d5767d70c6cb
Author: Guilherme Araújo <arauujogui@gmail.com>
Date: Sat Nov 28 15:50:45 2026 -0300
http: remove prototype primordial from server
`lib/internal/http/*.js` must not use prototype primordials. The
`ArrayPrototypeSlice` use added with the 'sendingHeaders' event fails
the JavaScript linter on main.
Refs: https://github.com/nodejs/node/pull/63996
Assisted-by: Claude
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/67852
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
diff --git a/lib/internal/http/server.js b/lib/internal/http/server.js
index a7de292987b..f6031f98a0a 100644
--- a/lib/internal/http/server.js
+++ b/lib/internal/http/server.js
@@ -23,7 +23,6 @@
const {
ArrayIsArray,
- ArrayPrototypeSlice,
Error,
MathMin,
NumberIsFinite,
@@ -478,7 +477,7 @@ function writeHead(statusCode, reason, obj) {
if (!k) continue;
const value = obj[n + 1];
// Appending duplicate fields must not mutate caller-owned arrays.
- this.appendHeader(k, ArrayIsArray(value) ? ArrayPrototypeSlice(value) : value);
+ this.appendHeader(k, ArrayIsArray(value) ? value.slice() : value);
}
} else if (obj) {
const keys = ObjectKeys(obj);
@@ -493,7 +492,7 @@ function writeHead(statusCode, reason, obj) {
const value = obj[k];
if (appendHeaders) {
// Appending duplicate fields must not mutate caller-owned arrays.
- this.appendHeader(k, ArrayIsArray(value) ? ArrayPrototypeSlice(value) : value);
+ this.appendHeader(k, ArrayIsArray(value) ? value.slice() : value);
} else {
this.setHeader(k, value);
}