#!/bin/sh
# Read-only HTTP probe. Requires curl. Usage: sh http-check.sh https://example.com
set -eu
if [ "$#" -ne 1 ]; then echo "Usage: $0 https://example.com" >&2; exit 2; fi
case "$1" in http://*|https://*) ;; *) echo 'Only HTTP/HTTPS URLs are supported.' >&2; exit 2;; esac
curl --fail --silent --show-error --location --max-redirs 5 --connect-timeout 5 --max-time 20 --output /dev/null --write-out 'HTTP: %{http_code}\nRemote IP: %{remote_ip}\nDNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTotal: %{time_total}s\n' -- "$1"
