libapse.lib: support for user-agent in curl request
This commit is contained in:
parent
a12a4f740b
commit
b391f4952c
1
Makefile
1
Makefile
@ -192,4 +192,3 @@ mostlyclean:
|
|||||||
$(MAKE) clean -C po/$$loc || exit 1;\
|
$(MAKE) clean -C po/$$loc || exit 1;\
|
||||||
done
|
done
|
||||||
@rm -f po/*.pot
|
@rm -f po/*.pot
|
||||||
|
|
||||||
|
@ -7,10 +7,12 @@
|
|||||||
curl_opts_netlink="--connect-timeout 15 --retry 3"
|
curl_opts_netlink="--connect-timeout 15 --retry 3"
|
||||||
# (default: "-L --remote-name --fail --progress-bar $curl_opts_netlink")
|
# (default: "-L --remote-name --fail --progress-bar $curl_opts_netlink")
|
||||||
curl_options="-R -L --remote-name --fail --progress-bar $curl_opts_netlink"
|
curl_options="-R -L --remote-name --fail --progress-bar $curl_opts_netlink"
|
||||||
# Sintax for 'proxy': "proxyhost:port"
|
# Syntax for 'proxy': "proxyhost:port"
|
||||||
proxy=""
|
proxy=""
|
||||||
# Sintax for 'proxy_user': "user:password"
|
# Sintax for 'proxy_user': "user:password"
|
||||||
proxy_user=""
|
proxy_user=""
|
||||||
|
# curl user agent
|
||||||
|
curl_user_agent="autospec/@version@ (Linux; openmamba; reports@openmamba.org)"
|
||||||
|
|
||||||
# Commands to run when a rpm package must be automatically installed
|
# Commands to run when a rpm package must be automatically installed
|
||||||
# (NOTE: it could be necessary to manually configure sudo
|
# (NOTE: it could be necessary to manually configure sudo
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# libapse.lib -- Autospec Package Search Engine library
|
# libapse.lib -- Autospec Package Search Engine library
|
||||||
# Copyright (C) 2007,2012 Stefano Cotta Ramusino <stefano.cotta@openmamba.org>
|
# Copyright (C) 2007,2012 Stefano Cotta Ramusino <stefano.cotta@openmamba.org>
|
||||||
# Copyright (C) 2008-2021 Silvan Calarco <silvan.calarco@mambasoft.it>
|
# Copyright (C) 2008-2024 Silvan Calarco <silvan.calarco@mambasoft.it>
|
||||||
|
|
||||||
[ "$libapse_is_loaded" = 1 ] || {
|
[ "$libapse_is_loaded" = 1 ] || {
|
||||||
libapse_is_loaded=1
|
libapse_is_loaded=1
|
||||||
@ -321,6 +321,8 @@ proxy:,proxy-user:,autoupdate-off: \
|
|||||||
local curr_curl_url pck_file new_version last_version
|
local curr_curl_url pck_file new_version last_version
|
||||||
local curr_curl_proxy_opts="\
|
local curr_curl_proxy_opts="\
|
||||||
${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}"
|
${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}"
|
||||||
|
local curr_curl_user_agent_opts="\
|
||||||
|
${curl_user_agent:+ --user-agent \"$curl_user_agent\"}"
|
||||||
|
|
||||||
for i in `seq 1 ${#autoupdate_off[*]}`; do
|
for i in `seq 1 ${#autoupdate_off[*]}`; do
|
||||||
apse_enabled[${autoupdate_off[$i-1]}]="0"
|
apse_enabled[${autoupdate_off[$i-1]}]="0"
|
||||||
@ -343,9 +345,9 @@ ${proxy:+ --proxy $proxy}${proxy_user:+ --proxy-user $proxy_user}"
|
|||||||
<${NOTE}$curr_curl_url${NORM}> (\`${NOTE}source0${NORM}')..."
|
<${NOTE}$curr_curl_url${NORM}> (\`${NOTE}source0${NORM}')..."
|
||||||
|
|
||||||
notify.debug "\
|
notify.debug "\
|
||||||
running: curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\""
|
running: curl $curr_curl_proxy_opts $curr_curl_user_agent_opts -s -L \"$curr_curl_url\""
|
||||||
curl $curl_opts_netlink \
|
curl $curl_opts_netlink \
|
||||||
$curr_curl_proxy_opts -s -L "$curr_curl_url" \
|
$curr_curl_proxy_opts $curr_curl_user_agent_opts -s -L "$curr_curl_url" \
|
||||||
> $fcurlout
|
> $fcurlout
|
||||||
let "retval = $?"
|
let "retval = $?"
|
||||||
|
|
||||||
@ -446,8 +448,8 @@ sort -t. -n -r -k1 -k2 -k3 -k4 -k5 -k6 -k7 -k8 -k9 -k10 ))
|
|||||||
|
|
||||||
curr_curl_url="http://sourceforge.net/projects/$src_name/files/latest/download"
|
curr_curl_url="http://sourceforge.net/projects/$src_name/files/latest/download"
|
||||||
notify.debug \
|
notify.debug \
|
||||||
"running: curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\""
|
"running: curl $curr_curl_proxy_opts $curr_curl_user_agent_opts -s -L \"$curr_curl_url\""
|
||||||
curl $curr_curl_proxy_opts -I -A Linux -s -L "$curr_curl_url" \
|
curl $curr_curl_proxy_opts $curr_curl_user_agent_opts -I -A Linux -s -L "$curr_curl_url" \
|
||||||
> $fcurlout
|
> $fcurlout
|
||||||
|
|
||||||
let "retval = $?"
|
let "retval = $?"
|
||||||
@ -503,15 +505,15 @@ $"looking at"" ${NOTE}(#$i)${NORM} <${NOTE}${apse_site_name[$i]}${NORM}>..."
|
|||||||
}
|
}
|
||||||
if [ "${apse_put_fields[$i]}" ]; then
|
if [ "${apse_put_fields[$i]}" ]; then
|
||||||
notify.debug "\
|
notify.debug "\
|
||||||
running: curl \$curr_curl_proxy_opts -s -L -d \
|
running: curl $curr_curl_proxy_opts $curr_curl_user_agent_opts -s -L -d \
|
||||||
\"${apse_put_fields[$i]}${search_name}\" \"$curr_curl_url\""
|
\"${apse_put_fields[$i]}${search_name}\" \"$curr_curl_url\""
|
||||||
curl $curr_curl_proxy_opts -s -L -d \
|
curl $curr_curl_proxy_opts $curr_curl_user_agent_opts -s -L -d \
|
||||||
"${apse_put_fields[$i]}${search_name}" "$curr_curl_url" \
|
"${apse_put_fields[$i]}${search_name}" "$curr_curl_url" \
|
||||||
> $fcurlout
|
> $fcurlout
|
||||||
else
|
else
|
||||||
notify.debug "\
|
notify.debug "\
|
||||||
running: curl \$curr_curl_proxy_opts -s -L \"$curr_curl_url\""
|
running: curl $curr_curl_proxy_opts $curr_curl_user_agent_opts -s -L \"$curr_curl_url\""
|
||||||
curl $curr_curl_proxy_opts -s -L "$curr_curl_url" > $fcurlout
|
curl $curr_curl_proxy_opts $curr_curl_user_agent_opts -s -L "$curr_curl_url" > $fcurlout
|
||||||
fi
|
fi
|
||||||
|
|
||||||
let "retval = $?"
|
let "retval = $?"
|
||||||
|
Loading…
Reference in New Issue
Block a user