From 81b31c0a4d450ad608d71d6ededb8b7c2cc420ca Mon Sep 17 00:00:00 2001 From: ygXXII <16456434+ygxxii@users.noreply.github.com> Date: Tue, 21 Feb 2023 23:20:04 +0800 Subject: [PATCH 1/2] Add "--location" to curl_opts --- lib/utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.sh b/lib/utils.sh index 89835c0..9f3e3bf 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -96,7 +96,7 @@ print_index_tab(){ delete_on_exit "$temp_headers_file" if [ -r "$etag_file" ]; then - curl_opts=(--header "If-None-Match: $(cat "$etag_file")") + curl_opts=(--location --header "If-None-Match: $(cat "$etag_file")") fi index=$(curl --fail --silent --dump-header "$temp_headers_file" ${curl_opts+"${curl_opts[@]}"} "${NODEJS_ORG_MIRROR}index.tab") From 9ce1bfc6e3e1f7ce0cc2a2aab189b24eb3243fe7 Mon Sep 17 00:00:00 2001 From: ygXXII <16456434+ygxxii@users.noreply.github.com> Date: Wed, 22 Feb 2023 09:38:50 +0800 Subject: [PATCH 2/2] Move "--location" from curl_opts to curl option Co-authored-by: Augusto Moura --- lib/utils.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils.sh b/lib/utils.sh index 9f3e3bf..60345fe 100644 --- a/lib/utils.sh +++ b/lib/utils.sh @@ -96,10 +96,10 @@ print_index_tab(){ delete_on_exit "$temp_headers_file" if [ -r "$etag_file" ]; then - curl_opts=(--location --header "If-None-Match: $(cat "$etag_file")") + curl_opts=(--header "If-None-Match: $(cat "$etag_file")") fi - index=$(curl --fail --silent --dump-header "$temp_headers_file" ${curl_opts+"${curl_opts[@]}"} "${NODEJS_ORG_MIRROR}index.tab") + index=$(curl --fail --silent --location --dump-header "$temp_headers_file" ${curl_opts+"${curl_opts[@]}"} "${NODEJS_ORG_MIRROR}index.tab") if [ "$index" ]; then awk 'tolower($1) == "etag:" { print $2 }' < "$temp_headers_file" > "$etag_file"