This script is meant to call wget on every IP returned by dig and display http response headers.
Usage is simple:
./script.sh http://www.example.com/ressource/with-long-cache-and-no-etag/big-image.jpg
Here's the code:
#!/bin/bash
BIN=${0##*/}
URL=${1?usage: $BIN url}
HOST=${URL#http://*}
REQ=${HOST#*/}
HOST=${HOST%%/*}
function check
{
wget -S --header="Host: $HOST" "http://$line/$REQ" -O/dev/null
}
dig +short $HOST | \
while read line
do
case $line in
[a-z]*)
;;
[0-9]*.[0-9]*.[0-9]*)
echo === Testing $HOST with IP $line
check $line
;;
*)
;;
esac
done
3 comments:
Ever heard of HEAD ?
It's part of libwww-perl on Debian.
S.
Hi, thanks for the tip.
I don't know if HEAD can handle a specific Host header. And I choose to not use perl.
And HEAD request sometimes are not handled like GET . Simulating a web browser with HEAD request is not accurate.
Nice post.
//Jadu
http://unstableme.blogspot.com/
Post a Comment