fix: pass proxy settings to curl in try_download #227
@@ -459,6 +459,26 @@ try_download () {
|
||||
no_mirror=true
|
||||
esac
|
||||
|
||||
local curl_proxy_args=()
|
||||
local _pp_conf=""
|
||||
if [[ -n "${XDG_CONFIG_HOME:-}" ]] \
|
||||
&& [[ -f "$XDG_CONFIG_HOME/PortProtonQt.conf" ]] ; then
|
||||
_pp_conf="$XDG_CONFIG_HOME/PortProtonQt.conf"
|
||||
elif [[ -f "$HOME/.config/PortProtonQt.conf" ]] ; then
|
||||
_pp_conf="$HOME/.config/PortProtonQt.conf"
|
||||
fi
|
||||
local _pp_url="" _pp_user="" _pp_pass=""
|
||||
if [[ -n "$_pp_conf" ]] ; then
|
||||
_pp_url="$(grep "proxy_url" "$_pp_conf" | awk -F"= " '{print $2}')"
|
||||
if [[ -n "$_pp_url" ]] ; then
|
||||
curl_proxy_args=(-x "$_pp_url")
|
||||
_pp_user="$(grep "proxy_user" "$_pp_conf" | awk -F"= " '{print $2}')"
|
||||
_pp_pass="$(grep "proxy_password" "$_pp_conf" | awk -F"= " '{print $2}')"
|
||||
[[ -n "$_pp_user" && -n "$_pp_pass" ]] \
|
||||
&& curl_proxy_args+=(-u "$_pp_user:$_pp_pass")
|
||||
fi
|
||||
fi
|
||||
|
||||
local filename
|
||||
if [[ -n "${PW_AUTOINSTALL_EXE}" ]] \
|
||||
&& [[ "$no_mirror" == "true" ]]
|
||||
@@ -482,7 +502,7 @@ try_download () {
|
||||
if check_gamescope_session ; then
|
||||
$PW_TERM "echo ; echo ; echo \"Downloading: $filename. Please wait...\" \
|
||||
; curl -f -# --connect-timeout 5 --speed-limit 1 --speed-time 5 -A 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)' -H 'Cache-Control: no-cache, no-store' \
|
||||
-H 'Pragma: no-cache' -L ${FIRST_URL[*]} -o \"$dest\""
|
||||
-H 'Pragma: no-cache' -L ${FIRST_URL[*]} -o \"$dest\" ${curl_proxy_args[*]}"
|
||||
|
||||
|
||||
[[ "$?" != 0 ]] && return 1 || return 0
|
||||
@@ -491,10 +511,10 @@ try_download () {
|
||||
# Normal download
|
||||
print_info "Download $filename from ${FIRST_URL[0]}..."
|
||||
if [[ "$silent" == "true" ]] ; then
|
||||
curl -f -# --connect-timeout 5 --speed-limit 1 --speed-time 5 -A 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)' -H 'Cache-Control: no-cache, no-store' \
|
||||
curl "${curl_proxy_args[@]}" -f -# --connect-timeout 5 --speed-limit 1 --speed-time 5 -A 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)' -H 'Cache-Control: no-cache, no-store' \
|
||||
-H 'Pragma: no-cache' -L "${FIRST_URL[@]}" -o "$dest" 2>&1
|
||||
else
|
||||
curl -f -# --connect-timeout 5 --speed-limit 1 --speed-time 5 -A 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)' -H 'Cache-Control: no-cache, no-store' \
|
||||
curl "${curl_proxy_args[@]}" -f -# --connect-timeout 5 --speed-limit 1 --speed-time 5 -A 'Mozilla/5.0 (compatible; Konqueror/2.1.1; X11)' -H 'Cache-Control: no-cache, no-store' \
|
||||
-H 'Pragma: no-cache' -L "${FIRST_URL[@]}" -o "$dest" 2>&1 \
|
||||
| tr '\r' '\n' | sed -ur 's|[# ]+||g;s|100||g;s|0-||g;s|.*=.*||g'
|
||||
|
||||
|
||||
Reference in new issue
Block a user