File tree Expand file tree Collapse file tree
iam-proxy-italia-project-demo-examples/spid_cie_oidc_django Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,9 +7,13 @@ WGET_OPTS="--timeout=5 --tries=1 --no-check-certificate --spider --server-respon
77
88function check_url {
99 local url=$1
10- http_status=$( wget $WGET_OPTS " $url " 2>&1 | awk ' /HTTP\// {print $2}' | tail -1)
11- if [[ ! $http_status =~ ^[23] ]]; then
12- echo " Error: wget failed for $url with status $http_status "
10+ local output http_status
11+ # wget exits non-zero on non-2xx; capture output anyway so we can enforce status == 200
12+ output=$( wget $WGET_OPTS " $url " 2>&1 ) || true
13+ http_status=$( echo " $output " | awk ' /HTTP\// {code=$2} END {print code}' )
14+ http_status=$( echo " $http_status " | tr -d ' \r[:space:]' )
15+ if [[ " $http_status " != " 200" ]]; then
16+ echo " Error: expected HTTP 200 from $url , got '${http_status:- empty} '"
1317 exit 1
1418 fi
1519}
You can’t perform that action at this time.
0 commit comments