mirror of
https://github.com/shivammathur/setup-php.git
synced 2026-11-26 21:42:06 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
+1
-1
@@ -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]"
|
||||
|
||||
Reference in New Issue
Block a user