summaryrefslogtreecommitdiff
path: root/head.bash
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2014-08-04 11:32:49 +0100
committerLuke Bratch <l_bratch@yahoo.co.uk>2014-08-04 11:32:49 +0100
commit4dd62f4540210e2143497943c5c51062c57cd73e (patch)
tree1d6bb67508d11669314a5dac727428fedb5bf45b /head.bash
parent181c0a0f2577e0c6417ba1173b170d1427659915 (diff)
Add support for detailing HTTP 301/302 redirectsHEADmaster
Diffstat (limited to 'head.bash')
-rwxr-xr-xhead.bash8
1 files changed, 6 insertions, 2 deletions
diff --git a/head.bash b/head.bash
index aa27d80..9b0881d 100755
--- a/head.bash
+++ b/head.bash
@@ -18,7 +18,7 @@ argrest=`echo "$url" | cut -d\ -f1 --complement`
if [[ $arg1 = "--version" ]]
then
- echo "Blatech head v0.2.2"
+ echo "Blatech head v0.3"
exit
elif [[ $arg1 = "-h" || $arg1 = "--help" ]]
then
@@ -36,10 +36,14 @@ sed -i ':a;N;$!ba;s/\r//g' head.txt
http=`grep HTTP head.txt`
modified=`grep Last-Modified head.txt | sed "s/Last-Modified: //"`
type=`grep Content-Type head.txt | cut -d " " -f2`
+location=`grep Location head.txt | cut -d " " -f2`
length=`grep Content-Length head.txt | cut -d " " -f2`
length=`filesize $length | sed -r "s/[ \t]{2,}//"`
-if [[ ! "$http" =~ "200" ]]
+if [[ "$http" =~ "301" || "$http" =~ "302" ]]
+then
+ echo "$http to $location"
+elif [[ ! "$http" =~ "200" ]]
then
echo $http
else