Repository navigation
Accept the dashboard's host:port:login:password proxy; refuse a gateway URL with no login - #6
Merged
Merged
Conversation
…ay URL with no login AVITO_PROXY / --proxy / --proxy-file lines in the 2Captcha dashboard's colon form (with or without http://) are now normalised to scheme://login:password@host:port, login and password percent-encoded and decoded again before Playwright, pyppeteer, the forwarder and the solver see them. A gateway URL without a login and password is refused by name when a session must be minted or pinned, instead of a login being spliced in front of the scheme and the run dying with "not a 2Captcha gateway". The login is now replaced inside the netloc, and no message built from a proxy value repeats the credential. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CKsd7q25N19WzUZjrAdzx8
Merged
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
tools/browser_profile_client.py connection --mint-session(the canary's "Build a fresh endpoint" step) died twice with "--proxy-sessions only applies to a 2Captcha proxy gateway … the URL given is not one". Two inputs reach that path:host:port:login:password(with or withouthttp://). Read as a URL it has no username and a "port" ofport:login:password, so a gateway credential looked like an IP-whitelisted one. urlparse'sValueErroron that port quotes the login.http://HOST:PORT,http://:pw@HOST:PORT).minted_proxyrebuilt the URL withbase.replace(parts.username or "", login, 1). With an empty username that puts the login in front ofhttp://, so the rebuilt URL has no host and the error blames the host.Behaviour now
proxy_pool.normalize_proxyrewrites the colon form toscheme://login:password@host:port. The scheme defaults to http, and the login and password are percent-encoded. It runs inparse_proxy_line(covering--proxyand--proxy-file),is_2captcha_gateway,mask,browser_bridge.parse_args(once, for every engine and the solver) and the browser-profile tool.split_credentials, pyppeteerauthenticate, the local forwarder'sProxy-Authorization, the solver'sproxyLogin/proxyPasswordand the profile tool'scustomProxy. That way a password containing@ : / % #arrives intact.require_gateway_loginrefuses a gateway URL that lacks a login and password, with "AVITO_PROXY has no login: session minting needs the gateway's LOGIN:PASSWORD form (…); an IP-whitelisted gateway URL cannot carry a -session-/-sessTime- id." The message never contains the credential. The tool exits 1; the scrapers exit 2 (argparse) when they would pin a session.with_login, which rebuilds the URL from its parts) and no longer by astr.replaceon the whole URL. A port that will not parse raises aProxyErrorbuilt from the masked value.AVITO_PROXYsection) documents both accepted forms and the refusal..env.examplecomment updated. CHANGELOG[Unreleased].Evidence
Python 3.13 core-only venv (
requirements.txt+ pytest):smoke_test.py: 684 checks, 0 failed, 6 skipped (engines absent).pytest -q: 94 passed.ci_checks.py --help-check,--sample-check,--secret-check,--wheel-check: all exit 0.env_config.pyandcompileall: 0.requirements-puppeteer.txt, no browser download): 699 checks, 0 failed; the pyppeteer argv guards ran.puppeteer_scraper.py --help: 0.New offline checks cover host-only, empty username, login without password, three colon fields, a plain login, a login already carrying
-session-/-sessTime-, socks5, a %-encoded password, and the colon form bare, withhttp://and with@ : / % #in the password. Each case goes throughminted_proxy,mint_sessions,parse_proxy_line,to_playwright,proxy_task_fields, the forwarder andparse_args. They also assert that no message contains the credential.Planted-fault controls (with
PYTHONDONTWRITEBYTECODE=1and__pycache__cleared):proxy_pool.py+ oldbrowser_profile_client.py→ 20 failed. The old code reproduces "the URL given is not one", and the oldValueErrorquotes the login.proxy_pool.py+ oldbrowser_profile_client.py→ 16 failed. All areminted_proxychecks, including host-sesstime-60ru.proxy.2captcha.comfrom the oldstr.replace.captcha_solver.py→ "solver fields decoded" fails (password sent still encoded).proxy_forwarder.py→ "the forwarder sends the decoded credential" fails.No paid calls, proxies or credentials were used, and nothing was sent to any 2Captcha endpoint.
Not changed
Canary policy, versions/releases, and the rest of the session-minting design.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CKsd7q25N19WzUZjrAdzx8