node_modules: update (#340)

Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
Dawid Dziurlaanddawidd6 authored and GitHub committed 2026-10-03 22:21:10 +02:00
1 parent 791f27c1e4
commit 0635835dfc
50 files changed
+835 -266

No files matched your search

+17 -7
View File
@@ -126,18 +126,28 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
.join('\r\n') +
// End request
'\r\n\r\n');
let headers = '';
// The response is collected as chunks and only the bytes that just arrived, together
// with the three before them, are searched for the end of the headers. Appending to a
// string and searching all of it again re-read the whole response on every chunk.
const chunks = [];
let received = 0;
let tail = '';
const onSocketData = (chunk) => {
let match;
let remainder;
if (finished) {
return;
}
headers += chunk.toString('binary');
if ((match = headers.match(/\r\n\r\n/))) {
const window = tail + chunk.toString('binary');
const windowEnd = window.indexOf('\r\n\r\n');
chunks.push(chunk);
received += chunk.length;
tail = window.slice(-3);
if (windowEnd >= 0) {
socket.removeListener('data', onSocketData);
remainder = headers.substr(match.index + match[0].length);
headers = headers.substr(0, match.index);
const headerEnd = received - window.length + windowEnd;
const response = Buffer.concat(chunks, received).toString('binary');
const headers = response.substr(0, headerEnd);
const remainder = response.substr(headerEnd + 4);
if (remainder) {
socket.unshift(Buffer.from(remainder, 'binary'));
}
@@ -161,7 +171,7 @@ function httpProxyClient(proxyUrl, destinationPort, destinationHost, tlsOptions,
socket.setTimeout(0);
return done(null, socket);
}
if (headers.length > MAX_RESPONSE_HEADER_BYTES) {
if (received > MAX_RESPONSE_HEADER_BYTES) {
socket.removeListener('data', onSocketData);
const err = new Error('Proxy response headers too large');
err.code = errors.EPROXY;