Public
Snippet $131 authored by Rafael Monnerat

curl-ttfb.sh

#!/bin/bash
function run() {
  while (($#)); do
    echo $1
    curl -so /dev/null -H "Pragma: no-cache" -H "Cache-Control: no-cache" \
        -v -w "Result: %{http_code}\tPre-Transfer: %{time_pretransfer}s\tStart Transfer: %{time_starttransfer}s\tTotal: %{time_total}s\tSize: %{size_download}\n" \
        "$1?`date +%s`" 2>&1 | grep 'Trying\|Result'
    shift
  done
}

# Run tests 6 times
run $*
run $*
run $*
run $*
run $*
run $*