Last active
October 9, 2017 12:49
-
-
Save hn-support/885fa037aaad17576cb9f44703c879ef to your computer and use it in GitHub Desktop.
Test urls using curl
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 | |
# This script is a very basic curl utility to analyze urls. | |
# To use it, download the file, make it executable, and run: | |
# ./curl_speedtest.sh https://www.byte.nl | |
URL="$1" | |
if [ "x${URL}" == "x" ] || [[ ! "${URL}" =~ "http" ]] ; then | |
echo "Usage: $0 <url>" | |
exit 1 | |
fi | |
curl -L -so /dev/null -w "\n[Info]\n\nStatus Code:\t%{http_code}\nHTTP Version:\t%{http_version}\nRemote IP:\t%{remote_ip}\n\n[Timing]\n\nConnect:\t%{time_connect}\tseconds\nPre-Transfer:\t%{time_pretransfer}\tseconds\nRedirect Time:\t%{time_redirect}\tseconds\nTransfer:\t%{time_starttransfer}\tseconds\nDNS Lookup:\t%{time_namelookup}\tseconds\nTotal Time:\t%{time_total}\tseconds\n\n[Size]\n\nDownload Size:\t%{size_download}\tbytes\nHeader Size:\t%{size_header}\tbytes\nRequest Size:\t%{size_request}\tbytes\n" $URL ; echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment