From 66f29b02f34406d13b76c86b2d5babdc52723f53 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Thu, 26 Nov 2026 20:10:41 +0100 Subject: [PATCH] Send a setup-php user agent and request compressed tool downloads (#1168) Downloads used curl's default user agent and no Accept-Encoding, so fallbacks to getcomposer.org transferred the full ~3.8MB phar instead of ~0.9MB gzipped, and could not be told apart from other curl traffic. --- src/scripts/tools/add_tools.sh | 3 +++ src/scripts/unix.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/scripts/tools/add_tools.sh b/src/scripts/tools/add_tools.sh index dc1e7bed..5a8d517b 100644 --- a/src/scripts/tools/add_tools.sh +++ b/src/scripts/tools/add_tools.sh @@ -263,6 +263,9 @@ add_tool() { fi else [ -f "$tool_path" ] && sudo cp -a "$tool_path" "$tool_path.bak" + # Tools are single files, so let servers gzip them in transit when curl can decode it. + local curl_opts=("${curl_opts[@]}") + curl -V | grep -qw libz && curl_opts+=(--compressed) status_code=$(get -v -e "$tool_path" "${url[@]}") if [ "$status_code" != "200" ] && [[ "${url[0]}" =~ ^https://github\.com/[^/]+/[^/]+/releases/latest/download/[^/?#]+$ ]]; then local release_url diff --git a/src/scripts/unix.sh b/src/scripts/unix.sh index 691c36a2..cec1f1ff 100644 --- a/src/scripts/unix.sh +++ b/src/scripts/unix.sh @@ -1,7 +1,7 @@ # Variables export tick="✓" export cross="✗" -export curl_opts=(-sL) +export curl_opts=(-sL -A "setup-php (+https://github.com/shivammathur/setup-php)") export old_versions="5.[3-5]" export jit_versions="8.[0-9]" export php_builder_versions="8.[3-9]"