#!/bin/sh
# httptime -- show HTTP response timing breakdown
set -eu

if [ -z "${1:-}" ]; then
    echo "Usage: httptime <url>" >&2
    exit 1
fi

curl -o /dev/null -s -w "
  DNS:        %{time_namelookup}s
  Connect:    %{time_connect}s
  TLS:        %{time_appconnect}s
  TTFB:       %{time_starttransfer}s
  Total:      %{time_total}s
  Size:       %{size_download} bytes
  Status:     %{http_code}
  Redirects:  %{num_redirects}
" "$1"
