Fix crash on IncompleteRead, which killed the first live run

The first scheduled run of #1157's workflows failed outright: a server
started a chunked HTTP response and then hung up mid-chunk, which
urllib surfaces as http.client.IncompleteRead - a subclass of
http.client.HTTPException, not of OSError/URLError/ValueError, so
probe()'s except clause let it propagate and took the whole run down
before it wrote anything to --json, including check_channels_fast.yml's
run.jsonl.

Catch http.client.HTTPException alongside the existing exceptions and
treat it as unreachable, same as any other broken connection. Verified
against the exact exception (mocked) and against the live lists.
This commit is contained in:
Kálmán „KAMI” Szalai
2026-09-04 11:49:36 +02:00
parent e52f1b34d8
commit 017955ad9e
+5 -1
View File
@@ -51,6 +51,7 @@ Usage:
"""
import argparse
import http.client
import json
import os
import re
@@ -139,7 +140,10 @@ def probe(url, timeout):
if error.code in REFUSING_CODES:
return REFUSED
return UNREACHABLE
except (urllib.error.URLError, OSError, ValueError):
except (urllib.error.URLError, OSError, ValueError, http.client.HTTPException):
# http.client.HTTPException covers a server that started a chunked
# response and then hung up mid-chunk (IncompleteRead) and similar
# low-level protocol violations - a broken connection, not a bad URL
return UNREACHABLE
return OK if looks_like_a_playlist(head) else GONE