#!/usr/bin/env bash
echo "=== https://account.allgifted.com ==="
curl -s -o /dev/null -w "  /             %{http_code}  %{size_download}b\n" https://account.allgifted.com/
curl -s -o /dev/null -w "  /login        %{http_code}  %{size_download}b\n" https://account.allgifted.com/login
curl -s -o /dev/null -w "  HTTP redirect %{http_code} -> %{redirect_url}\n" http://account.allgifted.com/

echo ""
echo "=== All allgifted vhosts (HTTPS) ==="
for h in math mathapi vocab vocabapi quiz account; do
  code=$(curl -s -o /dev/null -w "%{http_code}" https://${h}.allgifted.com/)
  printf "  %-30s %s\n" "${h}.allgifted.com" "$code"
done

echo ""
echo "=== Cert sanity (issuer + expiry) ==="
echo | openssl s_client -servername account.allgifted.com -connect account.allgifted.com:443 2>/dev/null \
  | openssl x509 -noout -issuer -dates -subject
