Skip to content

Commit b0ebb9d

Browse files
authored
Update check_urls.sh
1 parent cb06aa6 commit b0ebb9d

File tree

1 file changed

+5
-29
lines changed

1 file changed

+5
-29
lines changed

scripts/check_urls.sh

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,46 +5,22 @@
55
# This source code is licensed under the BSD-style license found in the
66
# LICENSE file in the root directory of this source tree.
77

8-
set -x
9-
10-
curl -I https://wiki.mozilla.org/Abstract_Interpretation
11-
curl -I https://mvnrepository.com/artifact/org.pytorch/executorch-android
12-
curl -I https://www.cadence.com/en_US/home.html
13-
curl -I https://www.cadence.com/en_US/home/tools/ip/tensilica-ip/hifi-dsps/hifi-4.html
14-
curl -I -A "Mozilla/5.0" https://wiki.mozilla.org/Abstract_Interpretation
15-
curl -I -A "Mozilla/5.0" https://mvnrepository.com/artifact/org.pytorch/executorch-android
16-
curl -I -A "Mozilla/5.0" https://www.cadence.com/en_US/home.html
17-
curl -I -A "Mozilla/5.0" https://www.cadence.com/en_US/home/tools/ip/tensilica-ip/hifi-dsps/hifi-4.html
18-
curl -I -A "" https://wiki.mozilla.org/Abstract_Interpretation
19-
curl -I -A "" https://mvnrepository.com/artifact/org.pytorch/executorch-android
20-
curl -I -A "" https://www.cadence.com/en_US/home.html
21-
curl -I -A "" https://www.cadence.com/en_US/home/tools/ip/tensilica-ip/hifi-dsps/hifi-4.html
22-
curl -I -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" https://wiki.mozilla.org/Abstract_Interpretation
23-
curl -I -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" https://mvnrepository.com/artifact/org.pytorch/executorch-android
24-
curl -I -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" https://www.cadence.com/en_US/home.html
25-
curl -I -A "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36" https://www.cadence.com/en_US/home/tools/ip/tensilica-ip/hifi-dsps/hifi-4.html
26-
curl -I -A "GitHubActions" https://wiki.mozilla.org/Abstract_Interpretation
27-
curl -I -A "GitHubActions" https://mvnrepository.com/artifact/org.pytorch/executorch-android
28-
curl -I -A "GitHubActions" https://www.cadence.com/en_US/home.html
29-
curl -I -A "GitHubActions" https://www.cadence.com/en_US/home/tools/ip/tensilica-ip/hifi-dsps/hifi-4.html
30-
318
set -euo pipefail
329

3310
status=0
3411
green='\e[1;32m'; red='\e[1;31m'; cyan='\e[1;36m'; yellow='\e[1;33m'; reset='\e[0m'
12+
user_agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36"
3513
last_filepath=
3614

3715
while IFS=: read -r filepath url; do
3816
if [ "$filepath" != "$last_filepath" ]; then
3917
printf '\n%s:\n' "$filepath"
4018
last_filepath=$filepath
4119
fi
42-
code=$(curl -g -sSL -m30 \
43-
-A 'Mozilla/5.0' \
44-
-H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' \
45-
--range 0-0 \
46-
-w '%{http_code}' -o /dev/null \
47-
"$url") || code=000
20+
code=$(curl -x fwdproxy:8080 -gsLm30 -o /dev/null -w "%{http_code}" -I "$url") || code=000
21+
if [ "$code" -ge 400 ]; then
22+
code=$(curl -x fwdproxy:8080 -gsLm30 -o /dev/null -w "%{http_code}" -r 0-0 -A "$user_agent" "$url") || code=000
23+
fi
4824
if [ "$code" -ge 200 ] && [ "$code" -lt 400 ]; then
4925
printf "${green}%s${reset} ${cyan}%s${reset}\n" "$code" "$url"
5026
else

0 commit comments

Comments
 (0)