One function

_extract_proxy_url in CloakHQ/CloakBrowser

The author described this change as fix: preserve HTTP proxy credentials during GeoIP resolution (#470). It counts as a record because the check below fails on the code as it stood at 093a66460 and passes on 3739d7bba, with nothing else changed between the two runs.

Fix saved2026-07-27
Sharing licenceMIT · LICENSE
Change size+7 4

What the code was meant to do, written into the code itself as a docstring

Extract and normalize proxy URL string from proxy param. For SOCKS5 dicts with separate username/password fields, reconstructs the full URL with inline credentials so SOCKS5 auth works.

The change

11 def _extract_proxy_url(proxy: str | ProxySettings | None) -> str | None:
22 """Extract and normalize proxy URL string from proxy param.
33
4- For SOCKS5 dicts with separate username/password fields, reconstructs
5- the full URL with inline credentials so SOCKS5 auth works.
4+ For proxy dicts with separate username/password fields, reconstructs
5+ the full URL with inline credentials so proxy auth works.
66 """
77 if proxy is None:
88 return None
1010 server = proxy.get("server", "")
1111 if not server:
1212 return None
13- if _is_socks_proxy(proxy):
14- return _reconstruct_socks_url(proxy)
13+ if proxy.get("username"):
14+ return (
15+ _reconstruct_socks_url(proxy) if _is_socks_proxy(proxy)
16+ else _reconstruct_http_url(proxy)
17+ )
1518 return _ensure_proxy_scheme(server)
1619 return _ensure_proxy_scheme(proxy)

The check that tells the two apart

failpass·tests/test_proxy.py::TestMaybeResolveGeoip::test_geoip_http_dict_reconstructs_credentials

Check file tests/test_proxy.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before it093a6646016f7068ff1bcf92a7ec4fd226f694b0
Broken version dated2026-07-26
Modulecloakbrowser.browser
Units changed_extract_proxy_url
Fingerprintff41f9378fe6b221
Checked2026-08-17 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.

Other bugs found in CloakHQ/CloakBrowser