Skip to content

Instantly share code, notes, and snippets.

@gadiener
Last active January 10, 2020 19:02
Show Gist options
  • Save gadiener/9144142792bd2b7a114984196487ae18 to your computer and use it in GitHub Desktop.
Save gadiener/9144142792bd2b7a114984196487ae18 to your computer and use it in GitHub Desktop.
Get http request info from curl command
#!/bin/bash
local template='lookup: %{time_namelookup}\nconnect: %{time_connect}\nappconnect: %{time_appconnect}\npretransfer: %{time_pretransfer}\nredirect: %{time_redirect}\nstarttransfer: %{time_starttransfer}\ntotal: %{time_total}\nhttp_code: %{http_code}\nnum_connects: %{num_connects}\nnum_redirects: %{num_redirects}\ntime_connect: %{time_connect}\ntime_namelookup: %{time_namelookup}\ntime_pretransfer: %{time_pretransfer}\ntime_starttransfer: %{time_starttransfer}\ntime_redirect: %{time_redirect}\ntime_total: %{time_total}\nsize_download: %{size_download}\nsize_upload: %{size_upload}\nspeed_download: %{speed_download}\nspeed_upload: %{speed_upload}'
curl -L --output /dev/null --silent --show-error --write-out "${template}" ${@}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment