Created
October 21, 2017 15:01
-
-
Save kamermans/b2d68b74686000cf3df255bef0e3ecd8 to your computer and use it in GitHub Desktop.
Curl helper that adds detailed timing information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
# Put this file in /usr/local/bin and use 'curl-timing' in place of 'curl' | |
# to get a detailed timing report with the response. | |
# You can customize the report below. For older versions of curl, some | |
# of the fields below will not be available. | |
TIMING_FORMAT=$(cat <<EOL | |
url_effective: %{url_effective} | |
remote_ip: %{remote_ip} | |
response: HTTP/%{http_version} %{http_code} | |
time_namelookup: %{time_namelookup} | |
time_connect: %{time_connect} | |
time_appconnect: %{time_appconnect} | |
time_pretransfer: %{time_pretransfer} | |
time_redirect: %{time_redirect} | |
time_starttransfer: %{time_starttransfer} | |
---------- | |
time_total: %{time_total} | |
speed_download: %{speed_download} Bps | |
\n | |
EOL | |
) | |
curl -w "$TIMING_FORMAT" $* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment