better comments

This commit is contained in:
Dallin Romney 2025-06-06 12:42:40 -07:00
parent 7a4116cf41
commit 78a6206622
2 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,10 @@
/*
This is a patched version of index.js from node-fetch 3.3.2 (see packages/fetch/node_modules/node-fetch/src/index.js)
This is to fix "Premature close" errors caused by chunked encoding assumptions - see https://github.com/continuedev/continue/issues/5502
The patch adjusts boundary chunk detection logic (see "PATCH" comment next to patch)
And is based on https://github.com/node-fetch/node-fetch/issues/1576
*/
/**
* Index.js
*
@ -481,9 +488,8 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
// previousChunk = buf;
// };
// VENDOR note - THIS IS THE REASON I AM PATCHING THIS PACKAGE
// PATCH - THIS IS WHERE THE PATCH IS - FIXES BOUNDARY CHUNKING ISSUE
// See https://github.com/node-fetch/node-fetch/issues/1576
// FIXES BOUNDARY CHUNKING ISSUE
const onData = (buf) => {
properLastChunkReceived = Buffer.compare(buf.slice(-5), LAST_CHUNK) === 0;

View file

@ -1,6 +1,7 @@
import { Buffer } from "node:buffer";
import { describe, expect, it } from "vitest";
// Tests the boundary chunking patch to node fetch made in node-fetch-patch.js (see that file for details).
describe("Chunked Transfer Encoding Patch Logic", () => {
// The LAST_CHUNK marker "0\r\n\r\n"
const LAST_CHUNK = Buffer.from("0\r\n\r\n");