got-scraping
got-scraping copied to clipboard
fix(resolve-protocol): isolate ALPN resolve queue per proxy
Problem
When sessionData is not provided, createResolveProtocol() falls back to global defaults (protocolCache + resolveAlpnQueue). The ALPN resolve queue is keyed only by target host/port (no proxy URL), so a hung proxy CONNECT/ALPN resolve can poison subsequent requests that rotate to a different proxy (they end up awaiting the same pending resolve).
Fix
- Scope the default ALPN caches/queue by
proxyUrlwhensessionDatais nullish. - Keep memory bounded via an LRU (
maxSize: 100).
Tests
- Add a regression test that starts a local HTTPS server + a hanging CONNECT proxy + a working CONNECT proxy.
- The second request (via the working proxy) must succeed even while the first request is still stuck on ALPN resolution via the hanging proxy.
CI ergonomics
- Make
npm testnon-interactive (vitest run). - Skip Apify-proxy integration tests when
APIFY_PROXY_PASSWORDis not set (keeps fork PR CI green, while still running in the main repo where the secret is available).