Switch proxy auth from URL-embedded to Proxy-Authorization header
Embedding credentials in the proxy URL (http://user:pass@host:port) was breaking HTTPS CONNECT tunnels on the hotel network. Switching to separate username/password fields (Playwright) and httpx.Proxy(auth=...) sends a Proxy-Authorization header instead, which passes through correctly. With DataImpulse IP whitelisting the 407 round-trip is skipped anyway so there is no latency penalty. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3b931d4915
commit
940ffbbe39
2 changed files with 33 additions and 21 deletions
|
|
@ -277,14 +277,13 @@ async def test_proxy_config(
|
|||
'password': (raw.get('booking_proxy_password') or '').strip(),
|
||||
'country': (raw.get('booking_proxy_country') or 'gb').strip(),
|
||||
}
|
||||
if not (proxy_util.is_enabled(cfg) and cfg['password']):
|
||||
raise HTTPException(status_code=400, detail="Proxy host, username and password must be saved first.")
|
||||
|
||||
proxy_url = proxy_util.httpx_proxy_url(cfg, proxy_util.new_session_id())
|
||||
if not proxy_util.is_enabled(cfg):
|
||||
raise HTTPException(status_code=400, detail="Proxy host and username must be saved first.")
|
||||
|
||||
import httpx
|
||||
proxy = proxy_util.httpx_proxy(cfg, proxy_util.new_session_id())
|
||||
try:
|
||||
async with httpx.AsyncClient(proxy=proxy_url, timeout=40.0) as client:
|
||||
async with httpx.AsyncClient(proxy=proxy, timeout=40.0) as client:
|
||||
resp = await client.get("https://ipinfo.io/json")
|
||||
resp.raise_for_status()
|
||||
data = resp.json()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue