Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 63 lines (56 sloc) 1.54 KB
#!/bin/bash
set -e -f -u -o pipefail
check_redirects() {
local expected_url="$1"
shift
local failures=0 url
for url in "$@"; do
# HTTP/1 uses "Location:", HTTP/2 uses "location:", so do a case-insensitive
# check.
if curl --silent --show-error --head "${url}" \
| grep -i -q "^location: ${expected_url}"; then
continue
fi
failures=$((failures + 1))
printf "Bad/missing redirect for %s, expected %s\\n" \
"${url}" "${expected_url}"
curl --head "${url}"
done
return "${failures}"
}
main() {
check_redirects "https://www.arianetobin.ie" \
"http://ariane.ie" \
"https://ariane.ie" \
"http://www.ariane.ie" \
"https://www.ariane.ie" \
\
"http://arianetobin.ie" \
"https://arianetobin.ie" \
\
"http://arianetobin.com" \
"https://arianetobin.com" \
"http://www.arianetobin.com" \
"https://www.arianetobin.com" \
\
"http://metalatplay.com" \
"https://metalatplay.com" \
"http://www.metalatplay.com" \
"https://www.metalatplay.com" \
\
"http://metalatwork.com" \
"https://metalatwork.com" \
"http://www.metalatwork.com" \
"https://www.metalatwork.com" \
\
"http://nakedmetalsmith.com" \
"https://nakedmetalsmith.com" \
"http://www.nakedmetalsmith.com" \
"https://www.nakedmetalsmith.com" \
check_redirects "https://dev.arianetobin.ie" "http://dev.arianetobin.ie"
check_redirects "https://www.johntobin.ie" \
"http://www.johntobin.ie" \
"http://johntobin.ie" \
"https://johntobin.ie"
}
main
You can’t perform that action at this time.