From 54c781773d559d2197ebc57e62c9d42fc26a85af Mon Sep 17 00:00:00 2001 From: Malin Date: Mon, 20 Apr 2026 19:42:10 +0200 Subject: [PATCH] fix: retry https on ConnectTimeout, not just ConnectError MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port 80 is often firewalled (drops packets → ConnectTimeout) rather than refused (ConnectError). Previously ConnectTimeout hit the generic except branch and broke without trying https, marking everything dead. Now ConnectError + RemoteProtocolError + ConnectTimeout all trigger an https retry. ReadTimeout still marks dead (server responded on connect but was too slow). Co-Authored-By: Claude Sonnet 4.6 --- app/validator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/validator.py b/app/validator.py index 9abb50a..7374a7d 100644 --- a/app/validator.py +++ b/app/validator.py @@ -152,14 +152,15 @@ async def _check_domain(domain: str) -> dict: result["prescreen_status"] = "live" return result - except (httpx.ConnectError, httpx.RemoteProtocolError) as e: - # Port refused or bad HTTP response → server may be https-only, try it + except (httpx.ConnectError, httpx.RemoteProtocolError, httpx.ConnectTimeout) as e: + # Port refused, wrong protocol, or port 80 firewalled/timed-out + # → server may be https-only, always retry on 443 if scheme == "http": logger.debug("Validator %s: %s on http, trying https", domain, type(e).__name__) continue break except Exception as e: - # Timeout or other error → https won't help, mark dead + # ReadTimeout or other error — connected but server too slow; mark dead logger.debug("Validator %s (%s): %s", domain, scheme, type(e).__name__) break