Repository navigation
feat: render: true forces headless Chrome; fix 403 challenges and files - #6
Merged
Merged
Conversation
- A challenge now counts before a refusal: Cloudflare sends its managed
challenge as HTTP 403 with cf-mitigated: challenge, which refetch filed
as a refusal and never took to headless Chrome. Both clients now read
cf-mitigated, and the challenge markers count on a 403 too.
- A PDF, an image or another file is an error ("not a web page or text
(application/pdf)") with a hand-off hint, instead of its bytes as text.
A body starting with %PDF- counts as a PDF whatever its type says.
- fetch_page's render: true (refetch get --force-render) reads the page
with headless Chrome even when the HTTP clients got it or were refused.
If Chrome cannot read it, the result is the HTTP client's text with a
note saying why.
- e2e: a /challenge-403 page, as Cloudflare sends it.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6 +/- ##
==========================================
+ Coverage 89.72% 89.75% +0.02%
==========================================
Files 18 18
Lines 1655 1689 +34
==========================================
+ Hits 1485 1516 +31
- Misses 169 172 +3
Partials 1 1
🚀 New features to boost your workflow:
|
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.
Three fixes from a review of refetch on real sites.
Cloudflare's 403 challenge goes to headless Chrome
Cloudflare sends its managed challenge as HTTP 403 with
cf-mitigated: challenge. refetch checked for 403/429 before it checked for a challenge, so it filed the page asrefusedand never ran headless Chrome. Now:cf-mitigatedFiles are an error, not bytes
A PDF, an image or another file used to come back as its raw bytes, cut to
max_chars. Now:not a web page or text (application/pdf)%PDF-counts as a PDF even when the server calls it textrender: trueforces headless Chromerendercould only turn Chrome off. Withrender: true(CLI:refetch get --force-render), headless Chrome reads the page even when the HTTP clients got it or were refused. This is for pages whose content scripts fill in, which detection can miss. If Chrome can't read the page, the result is the HTTP client's text, with a note saying why.One change in behavior: a call that passed
render: trueused to behave as if it had been left out. Now it always runs Chrome.Checks
NotTexttablecf-mitigatedread by both real clients (through the proxy test's backend)/challenge-403fixture. Withrefetch get:refusedchallenge, then headless Chromeokmake test,make lint(macOS andGOOS=linux),make cover-check(89.0%; 87% of the changed lines),claude plugin validate . --strict.e2e/run.py(about 35 Claude sessions).🤖 Generated with Claude Code
BEGIN_COMMIT_OVERRIDE
feat: fetch_page render true forces headless Chrome, even for a page the HTTP clients read (#6)
fix: send a Cloudflare challenge that arrives as HTTP 403 to headless Chrome (#6)
fix: refuse PDFs, images and other files with a clear error instead of their bytes (#6)
END_COMMIT_OVERRIDE