mirror of
https://github.com/Free-TV/IPTV.git
synced 2026-09-24 19:17:14 +02:00
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:
+5
-1
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user