From 8264d45caff8e13d1da70d8d383e99627f681cd0 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Thu, 6 Jan 2022 14:25:46 +0100 Subject: [PATCH] tests/test00_specsyntax: provide a fake user agent instead of culr default to prevent some sites from blocking --- tests/test00_specsyntax.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test00_specsyntax.in b/tests/test00_specsyntax.in index 35305ad..6d217ce 100644 --- a/tests/test00_specsyntax.in +++ b/tests/test00_specsyntax.in @@ -41,6 +41,7 @@ function specfile.checksyntax() { notify.note " * $specfile" local total_issues=0 + local user_agent="Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/81.0" # 0. checking if 'Source[0]' is a valid internet address # (skip this test if no '%setup' section has been found) @@ -48,10 +49,10 @@ function specfile.checksyntax() { notify.note "$(test.num2str). ${NOTE}"\ "url""${NORM}..." if [[ "$SPEC_URL" ]]; then - http_code=`curl -s -o /dev/null -w "%{http_code}" $SPEC_URL` + http_code=`curl -s -o /dev/null -w "%{http_code}" -A "${user_agent}" $SPEC_URL` if [ "$http_code" != "200" ]; then if [ "${http_code:0:2}" == "30" ]; then - http_effective_url=`curl -w "%{url_effective}" -I -L -s -o /dev/null -S $SPEC_URL` + http_effective_url=`curl -w "%{url_effective}" -I -L -s -o /dev/null -A "${user_agent}" -S $SPEC_URL` { notify.warning "\ \`url': "$"redirect detected: replacing from \`$SPEC_URL' to \`${http_effective_url}'" let "total_issues += 1";