diff --git a/proxy-skeleton/app/background.py b/proxy-skeleton/app/background.py index ad9e305..14e04ce 100644 --- a/proxy-skeleton/app/background.py +++ b/proxy-skeleton/app/background.py @@ -8,7 +8,7 @@ import time import requests from redis import Redis -from .config import PROXY_POOL, SMARTPROXY_POOL, IP_CHECKER, MAX_PROXY_CHECKERS +from .config import PROXY_POOL, SMARTPROXY_POOL, IP_CHECKER, MAX_PROXY_CHECKERS, SMARTPROXY_BV3HI_FIX from .pid import zombie_slayer from .redis_cycle import add_backend_cycler from .smartproxy import transform_smartproxy @@ -46,10 +46,14 @@ def validate_proxies(): if pxy in SMARTPROXY_POOL: smartproxy = True r = requests.get(IP_CHECKER, proxies={'http': transform_smartproxy(pxy), 'https': transform_smartproxy(pxy)}, timeout=15) - # r_test = requests.get(TEST_LARGE_FILE, proxies={'http': transform_smartproxy(pxy), 'https': transform_smartproxy(pxy)}, timeout=15) + + # TODO: remove when fixed + r2 = requests.get(SMARTPROXY_BV3HI_FIX, proxies={'http': transform_smartproxy(pxy), 'https': transform_smartproxy(pxy)}, timeout=15) + if r2.status_code != 200: + logger.debug(f'PROXY BV3HI TEST failed - {pxy} - got code {r2.status_code}') + return else: r = requests.get(IP_CHECKER, proxies={'http': pxy, 'https': pxy}, timeout=15) - # r_test = requests.get(TEST_LARGE_FILE, proxies={'http': pxy, 'https': pxy}, timeout=15) if r.status_code != 200: logger.debug(f'PROXY TEST failed - {pxy} - got code {r.status_code}') diff --git a/proxy-skeleton/app/config.py.example b/proxy-skeleton/app/config.py.example index 67c57a6..07b1db4 100644 --- a/proxy-skeleton/app/config.py.example +++ b/proxy-skeleton/app/config.py.example @@ -13,6 +13,10 @@ PROXY_POOL = [ SMARTPROXY_USER = 'example' SMARTPROXY_PASS = 'password' +# Fix the 503 error on some SmartProxy hosts. +# TODO: remove when fixed. +SMARTPROXY_BV3HI_FIX = 'https://files.catbox.moe/c8p1q6.png' + # Some domains just don't work through SmartProxy. Domains in this list are routed though # your proxies, not SmartProxy. BYPASS_SMARTPROXY_DOMAINS = [ diff --git a/proxy-skeleton/app/plugins/load_balancer.py b/proxy-skeleton/app/plugins/load_balancer.py index 8e0ca02..c3e2f36 100644 --- a/proxy-skeleton/app/plugins/load_balancer.py +++ b/proxy-skeleton/app/plugins/load_balancer.py @@ -140,6 +140,7 @@ class ProxyLoadBalancer(TcpUpstreamConnectionHandler, HttpProxyBasePlugin): self._metadata = [ host, port, path, request.method, ] + # Queue original request optionally with auth headers to upstream proxy if self._endpoint.has_credentials: assert self._endpoint.username and self._endpoint.password