Categories
Posts

curlt: cURL With Timing

I’ve previously talked about how to get timing details with cURL. On that post is a comment by Matthias Lüdtke linking to a curlt script.

I liked that script so much that I’ve added it to my standard set of shell tools. My slightly modified version is at https://github.com/josephscott/shell/blob/master/bin/curlt.

For easy reference, here is how my curlt looks right now:

[sourcecode lang=”shell”]
#!/bin/bash

curl_format='{
"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}
}’

curl -w "$curl_format" -k –compressed -v -s -o /dev/null "$@"
[/sourcecode]