Skip to content

Instantly share code, notes, and snippets.

@bogdanbarna
Created April 12, 2021 09:23
Show Gist options
  • Save bogdanbarna/996ea91fda8e408f3797c7517feb38b0 to your computer and use it in GitHub Desktop.
Save bogdanbarna/996ea91fda8e408f3797c7517feb38b0 to your computer and use it in GitHub Desktop.
Time response with cURL
#!/bin/bash
# Shamelessly copied from
# https://blog.josephscott.org/2011/10/14/timing-details-with-curl/
if [[ -n $DEBUG ]]; then set -x; fi
set -euf
curl -w @- -o /dev/null -s "$@" <<'EOF'
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment