|
|
@@ -77,22 +77,32 @@ mkdir -p "$cache_dir" "$scratch/logs"
|
|
|
curl_metadata_args=(
|
|
|
--fail --silent --show-error --location
|
|
|
--retry 3 --retry-all-errors --retry-delay 2
|
|
|
- --connect-timeout 10 --max-time 30 --retry-max-time 120
|
|
|
+ --http1.1 --connect-timeout 10 --max-time 30 --retry-max-time 120
|
|
|
)
|
|
|
|
|
|
download_node_archive() {
|
|
|
- local url="$1" output="$2" attempt status=0
|
|
|
+ local version="$1" output="$2" attempt status=0
|
|
|
+ local archive="node-$version-win-x64.zip"
|
|
|
+ local primary_url="https://nodejs.org/dist/$version/$archive"
|
|
|
+ local mirror_url="https://npmmirror.com/mirrors/node/$version/$archive"
|
|
|
+
|
|
|
+ if curl --fail --silent --show-error --location --http1.1 \
|
|
|
+ --connect-timeout 10 --max-time 300 --speed-limit 1024 --speed-time 30 \
|
|
|
+ -o "$output" "$primary_url"; then
|
|
|
+ return 0
|
|
|
+ fi
|
|
|
+ echo 'wine-windows-gates: nodejs.org archive transfer stalled; resuming from the checksum-untrusted transport mirror' >&2
|
|
|
for attempt in 1 2 3; do
|
|
|
- if curl --fail --silent --show-error --location \
|
|
|
+ if curl --fail --silent --show-error --location --http1.1 \
|
|
|
--continue-at - --connect-timeout 10 --max-time 300 \
|
|
|
--speed-limit 1024 --speed-time 30 \
|
|
|
- -o "$output" "$url"; then
|
|
|
+ -o "$output" "$mirror_url"; then
|
|
|
return 0
|
|
|
else
|
|
|
status=$?
|
|
|
fi
|
|
|
(( attempt < 3 )) || break
|
|
|
- echo "wine-windows-gates: Windows Node archive transfer failed (exit $status) on attempt $attempt; resuming partial download" >&2
|
|
|
+ echo "wine-windows-gates: mirror transfer failed (exit $status) on attempt $attempt; resuming partial download" >&2
|
|
|
done
|
|
|
return "$status"
|
|
|
}
|
|
|
@@ -109,7 +119,7 @@ provision_node() {
|
|
|
if [ -n "$version" ]; then
|
|
|
zip="$cache_dir/node-$version-win-x64.zip"
|
|
|
if [ ! -f "$zip" ]; then
|
|
|
- download_node_archive "https://nodejs.org/dist/$version/node-$version-win-x64.zip" "$zip.tmp"
|
|
|
+ download_node_archive "$version" "$zip.tmp"
|
|
|
local expected
|
|
|
expected="$(curl "${curl_metadata_args[@]}" "https://nodejs.org/dist/$version/SHASUMS256.txt" \
|
|
|
| awk -v a="node-$version-win-x64.zip" '$2 == a { print $1; exit }')"
|