Commit 9ee1eb3a authored by Vitaly Lipatov's avatar Vitaly Lipatov

check_system/check-blocked: distinguish HTTP errors from real blocks

Use eget --get-response to get HTTP status code when --check-url fails. Shows HTTP403 (Cloudflare challenge) vs BLOCK (no connection). Co-Authored-By: 's avatarClaude Opus 4.6 <noreply@anthropic.com>
parent ebad1f4a
......@@ -104,7 +104,6 @@ for site in $sites ; do
speed=$(run_eget "$proxy" --speedtest --tsv "$url" 2>/dev/null | cut -f2)
[ -z "$speed" ] && speed="0.00"
# Compare with threshold (using awk for float comparison)
is_slow=$(echo "$speed $SLOW_THRESHOLD" | awk '{print ($1 < $2) ? 1 : 0}')
if [ "$is_slow" = "1" ] ; then
......@@ -113,7 +112,13 @@ for site in $sites ; do
cell="OK($speed)"
fi
else
cell="BLOCK"
# --check-url failed: distinguish BLOCK (no connection) from HTTP error
http_code=$(run_eget "$proxy" --get-response "$url" 2>/dev/null | head -1 | awk '{print $2}')
if [ -n "$http_code" ] ; then
cell="HTTP$http_code"
else
cell="BLOCK"
fi
fi
printf " %-14s" "$cell"
......@@ -125,4 +130,5 @@ done
echo
echo "Legend: OK(N) = available, N MB/s download speed"
echo " SLOW(N) = available but speed < ${SLOW_THRESHOLD} MB/s (throttled)"
echo " BLOCK = connection failed (blocked or down)"
echo " HTTP403 = server responded with error (e.g. Cloudflare challenge)"
echo " BLOCK = no connection (blocked or down)"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment