aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Eckert <fe@dev.tdt.de>2022-01-15 15:24:43 +0100
committerGitHub <noreply@github.com>2022-01-15 15:24:43 +0100
commite85fa926e6c20e1487431aaa602a52e05d30be60 (patch)
treede5ea9df4c5415c28f722f4c5fd44cf18e9e975b
parent0f0c7b8ea40129fbe4f3997392bea31d4b08a556 (diff)
parentdc0953fedd19cf77e76e0198457ab2f1a24b1572 (diff)
Merge pull request #17600 from camarel/feature/ddns-scripts-wget-user-agent
ddns-scripts: pass user agent string
-rw-r--r--net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh7
-rw-r--r--net/ddns-scripts/samples/ddns.config_sample5
2 files changed, 12 insertions, 0 deletions
diff --git a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
index f36d11ca7..cb345e846 100644
--- a/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
+++ b/net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
@@ -745,6 +745,13 @@ do_transfer() {
# disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set)
[ -z "$proxy" ] && __PROG="$__PROG --no-proxy"
+ # user agent string if provided
+ if [ -n "$user_agent" ]; then
+ # replace single and double quotes
+ user_agent=$(echo $user_agent | sed "s/'/ /g" | sed 's/"/ /g')
+ __PROG="$__PROG --user-agent='$user_agent'"
+ fi
+
__RUNPROG="$__PROG '$__URL'" # build final command
__PROG="GNU Wget" # reuse for error logging
diff --git a/net/ddns-scripts/samples/ddns.config_sample b/net/ddns-scripts/samples/ddns.config_sample
index a3aa7e813..46bd8abe2 100644
--- a/net/ddns-scripts/samples/ddns.config_sample
+++ b/net/ddns-scripts/samples/ddns.config_sample
@@ -221,6 +221,11 @@ config service "myddns"
# option ip_source "script"
# option ip_script ""
+ # This option can be used in combination with ip_source "web" and ip_url.
+ # It adds a given user agent string to the request.
+ # Will only be used when wget or wget-ssl is installed.
+# option user_agent "Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/95.0"
+
###########
# force_ipversion option will set the "-4" respectively "-6" parameter
# on command line of transfer and DNS lookup program.