Repository navigation
Conversation
Node's fetch rejects any response with more than 16 KB of headers (UND_ERR_HEADERS_OVERFLOW) before the body is read. YouTube watch pages now send about 18.5 KB, 13.4 KB of it in a connection-allowlist-report-only header, so the CLI printed only "fetch failed" for every YouTube URL. fetchPage still tries the global fetch first. Only on that error code does it retry once through node:http/node:https with a 128 KB header limit, reusing the Node request code the proxy path already had (now nodeGet and fetchPageViaNode, with an optional proxy). Proxied target responses get the same limit. node:https is required lazily, so the Worker and browser bundles are unaffected; only Node's fetch produces that error code. The Node path now settles on the headers alone for non-2xx, non-HTML and oversized responses, so a rejected response that keeps streaming cannot hold the CLI open. Header checks live in one validateHeaders helper shared by both paths. Rejected: adding undici for setGlobalDispatcher, a 2.2 MB dependency whose v8 drops Node 20 Rejected: routing every Node page fetch through node:http, changes requests for sites that work today Rejected: a browser user agent for YouTube, still 12.4 KB of headers and fixes one site only
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #556
YouTube watch pages now send about 18.5 KB of response headers, and Node's fetch rejects anything over 16 KB with
UND_ERR_HEADERS_OVERFLOW, sodefuddle parsefails on every YouTube URL with onlyfetch failed.fetchPagestill tries the global fetch first. Only on that error code does it retry once throughnode:http/node:httpswithmaxHeaderSizeset to 128 KB, reusing the request code the proxy path already had:node:httpsis required lazily, so the browser bundles don't reference it.Accept-Encoding).New tests, all against local servers (none calls YouTube):
The first five and the CLI test fail on
main.npm test, the build, the lint scripts andsizepass on Node 24, and the fetch and CLI tests also pass on Node 22. The Worker still bundles (wrangler deploy --dry-run).The HTTPS code paths have no automated test, because that would need a test certificate. I checked the direct one by hand: the built CLI fetches a real YouTube URL and prints the transcript. HTTPS through a proxy is untested.