summaryrefslogtreecommitdiff
path: root/metadata/scripts/verify-uiinfo-urls.sh
blob: b7e1f40aef224f57f702004d003ad5c23730cedd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/bash

x=$1
if [ ! -f "$x" ]; then
	exit
fi

for i in `cat $x | sed 's;\(</*\)[a-z0-9]*:;\1;g' | sed 's/xmlns="[^"]*"//' | xmllint --xpath /EntityDescriptor//Extensions/UIInfo - 2>/dev/null |grep -E "https?://" | awk -F'[><]' '{print $3}' | sort -u`; do
	code=`curl -L --connect-timeout 5 --retry 2 -o /dev/null --silent --head --write-out '%{http_code}\n' $i`
	if [ $code -eq 405 ]; then 
		code=`curl -L --connect-timeout 5 --retry 2 -o /dev/null --silent --write-out '%{http_code}\n' $i`
	fi
	if [ $code -ne 200 ]; then
		echo "  Code $code: $x: $i" | sed 's/.*/&/'
	fi
done