triage: handle review findings

This commit is contained in:
2026-05-16 15:19:00 +00:00
parent 46f2a05148
commit f1206e46c7
3 changed files with 21 additions and 24 deletions
+8 -1
View File
@@ -39,6 +39,13 @@ if [ -z "$HEALTH_CODE" ] || [ "$HEALTH_CODE" = "null" ]; then
fail "HEALTH_CODE 不可為空。"
fi
case "$CHECK_URL" in
http://*|https://*) ;;
*)
fail "CHECK_URL 只允許 http:// 或 https://。"
;;
esac
log "[INFO] CHECK_URL=$CHECK_URL"
log "[INFO] HEALTH_CODE=$HEALTH_CODE"
@@ -48,7 +55,7 @@ log "[INFO] 開始檢查:$CHECK_URL"
while true; do
printf '[%s] [INFO] GET %s ... ' "$(timestamp)" "$CHECK_URL"
status_code="$(curl -sS --max-time 60 --url "$CHECK_URL" -o /dev/null -w '%{http_code}' || true)"
status_code="$(curl -sS --proto '=http,https' --proto-redir '=http,https' --max-time 60 --url "$CHECK_URL" -o /dev/null -w '%{http_code}' || true)"
if [ -z "$status_code" ]; then
status_code="000"
fi