diff --git a/lib/internal/http/agent.js b/lib/internal/http/agent.js index 20aef9f8376..cd17592d06c 100644 --- a/lib/internal/http/agent.js +++ b/lib/internal/http/agent.js @@ -617,7 +617,7 @@ Agent.prototype.removeSocket = function removeSocket(s, options) { // If the socket was destroyed, remove it from the free buffers too. if (!s.writable) - sets.push(this.freeSockets); + sets[sets.length] = this.freeSockets; for (let sk = 0; sk < sets.length; sk++) { const sockets = sets[sk]; diff --git a/lib/internal/http/outgoing.js b/lib/internal/http/outgoing.js index 6dfdbb24441..5c2efbfb7d9 100644 --- a/lib/internal/http/outgoing.js +++ b/lib/internal/http/outgoing.js @@ -370,7 +370,7 @@ OutgoingMessage.prototype.uncork = function uncork() { this._send(crlf_buf, null, null); for (let n = 0; n < buf.length; n += 3) { this._send(buf[n + 0], buf[n + 1], null); - callbacks.push(buf[n + 2]); + callbacks[callbacks.length] = buf[n + 2]; } this._send(crlf_buf, null, (err) => { for (const callback of callbacks) { @@ -1300,8 +1300,8 @@ function queueEndCallback(msg, callback) { process.nextTick(callback, msg[kFlushError]); return; } - msg[kEndCallbacks] ??= []; - msg[kEndCallbacks].push(callback); + const callbacks = msg[kEndCallbacks] ??= []; + callbacks[callbacks.length] = callback; } function onFinish(outmsg, err) { diff --git a/lib/internal/http/server.js b/lib/internal/http/server.js index f6031f98a0a..4f58399e187 100644 --- a/lib/internal/http/server.js +++ b/lib/internal/http/server.js @@ -1417,7 +1417,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { } } - state.incoming.push(req); + state.incoming[state.incoming.length] = req; // If the writable end isn't consuming, then stop reading // so that we don't become overwhelmed by a flood of @@ -1466,7 +1466,7 @@ function parserOnIncoming(server, socket, state, req, keepAlive) { if (socket._httpMessage) { // There are already pending outgoing res, append. - state.outgoing.push(res); + state.outgoing[state.outgoing.length] = res; } else { res.assignSocket(socket); }