Drill: HTTP Debugging with curl¶
Goal¶
Use curl with verbose flags, custom resolution, and connection overrides to debug HTTP/HTTPS issues.
Setup¶
- Linux system with curl installed
- A target HTTP service to test
Commands¶
Verbose output showing headers and TLS handshake:
Show only response headers:
Show timing breakdown:
curl -w "dns: %{time_namelookup}s\nconnect: %{time_connect}s\ntls: %{time_appconnect}s\nfirstbyte: %{time_starttransfer}s\ntotal: %{time_total}s\n" -o /dev/null -s https://example.com
Override DNS resolution (test before DNS change):
Connect to a different backend (useful for testing behind a load balancer):
Send a request with custom headers:
Follow redirects and show the chain:
Test with specific TLS version:
What to Look For¶
time_namelookupmuch larger than 0 may indicate DNS issues- Gap between
time_connectandtime_appconnectshows TLS handshake overhead time_starttransferminustime_appconnectis server processing time- Response codes, redirect chains, and header values for debugging routing
Common Mistakes¶
- Forgetting that
-voutput goes to stderr (use2>&1to capture it) - Not using
--resolveto test against specific backends before DNS changes - Ignoring the difference between
-I(HEAD) and-v(GET with verbose) - Not checking certificate details in verbose TLS output for cert mismatches
Cleanup¶
No cleanup needed. curl is a client-side tool with no server-side effects (for GET/HEAD).