Advanced curl debugging

Advanced curl debugging

Use curl write-out option

https://curl.haxx.se/docs/manpage.html

Exemple with a curl.cfg file with “csv” style output :

%{http_code};%{http_connect};%{stderr};%{stdout};%{time_namelookup};%{time_connect};%{time_appconnect};%{time_pretransfer};%{time_redirect};%{time_starttransfer};%{time_total};%{size_download};%{size_header};%{size_request};%{size_upload}\n

Use this output configuration in curl :

curl -s -o /dev/null -w "@curl.cfg" https://ralex.fr

Output :

;;200;200;;0,000065;0,000230;0,156049;0,156175;0,000000;0,187346;0,187442;5311;814;180;0;

Use parallel to launch simultaneous requests

seq 1000 | parallel -j5 'date=$(date "+%d-%m-%Y %H:%M:%S") curl=$(curl -s -o /dev/null -w "@curl.cfg" https://ralex.fr) && echo ${date}${curl} >> result.csv'

Timing diagram

Curl Timing

From Cloudflare blog