Skip to content

Instantly share code, notes, and snippets.

@bradleygolden
Last active November 13, 2015 12:09
Show Gist options
  • Select an option

  • Save bradleygolden/64b338e9a44372feab0c to your computer and use it in GitHub Desktop.

Select an option

Save bradleygolden/64b338e9a44372feab0c to your computer and use it in GitHub Desktop.
Tests the http response header of a given set of URIs
#!/bin/bash
# to run: $ bash <ip> <port>
host=$1
port=$2
while read LINE; do
if [ ! ${LINE:0:1} == "#" ]
then
curl -o /dev/null --silent --get --write-out '%{http_code}' "$host:$port$LINE"
echo " $LINE"
else
echo " $LINE"
fi
done < url-list.txt
#should pass
/favicon.ico
/google.gif
/index.html
/monorail.jpg
/pic.html
/skype.png
/
#should fail
/whoops.ico
/googl.gif
/indx.html
/monoril.jpg
/pc.html
/skyp.png
#should pass
/test/
/test/dir/
/test/dir/endtoend.pdf
/test/dir/index.html
/test/dir/testpage.html
#should fail
/tests/
/test/dirs/
/test/dir/endtond.pdf
/test/dir/indx.html
/test/dir/testpae.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment