Repository navigation
Stop on a refused proxy before the browser starts; add opt-in media blocking - #6
Merged
Merged
Conversation
…edia blocking A proxy that answers 407 or 402 to a one-request pre-check (CONNECT plus HEAD /robots.txt on www.webmotors.com.br) now ends the run with exit 5 and <out>.latest_attempt.meta.json (status failed, stop_reason proxy_auth_failed / proxy_balance_exhausted) instead of surfacing as a Chromium navigation timeout on every retry. --block-media aborts image, media and font requests in all three engines; it is off by default here because its effect on PerimeterX could not be measured. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CKsd7q25N19WzUZjrAdzx8
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.
Problem
A run through a metered residential proxy wasted traffic and time when the proxy refused it. Chromium reports a proxy's HTTP 407 as
Page.goto: Timeout ... exceeded. The canary on 2026-10-20 showed this:/api/search/... Page.goto: Timeout 60000msthree times through the proxy, then exit 5, with nothing naming the credential.Resulting behaviour
Pre-check, in all three engines. When a local proxy is configured,
page_flow.stop_on_refused_proxysends one request through it before any browser is launched. That request is a CONNECT towww.webmotors.com.br:443followed byHEAD /robots.txtinside the tunnel. No third-party IP service is involved.WEBMOTORS_PROXY (or --proxy / --proxy-file). It exits 5 and writes<out>.latest_attempt.meta.jsonwithstatus: failedandstop_reason: proxy_auth_failed.stop_reason: proxy_balance_exhausted.<out>.meta.jsonand any previous output are left untouched.--cdp-endpoint.Media blocking, opt-in on this site (
--block-media). When enabled, it aborts image, media and font requests:context.route, by resource type.Fetch.enablewith Image/Media/Font patterns, on its own CDP session. This leaves the engine's existing Fetch-based proxy auth alone.Network.setBlockedURLs, by file extension.--load-media/WEBMOTORS_LOAD_MEDIA=1keeps media loading. Neither flag does anything over CDP.Why media blocking is off by default here. The rows come from the site's JSON API, which needs no media. The landing page, however, runs PerimeterX, which has refused this scraper for smaller identity inconsistencies. A free comparison run on 2026-10-20 (no proxy, one search page, media loaded vs
--block-media) was refused by CloudFront both times, because this datacentre address is refused before the site sees the request. So whether PerimeterX reacts to blocked resources could not be measured, and the default keeps media.Evidence
Offline suite
New checks
--block-mediawith and without a proxy,--load-media, CDP.failRequest, and the Selenium URL list.scrape()on a 407 stub: exit 5, no browser started, sidecar written, credential absent from the log.Planted-fault controls. Each fault turned the named check red, and the suite was green again after the restore.
stop_on_refused_proxycall removed from each of the three engines → ": a 407 exits 5 without starting a browser".Other
Not changed
🤖 Generated with Claude Code
https://claude.ai/code/session_01CKsd7q25N19WzUZjrAdzx8