Browse Source

Merge pull request #17600 from camarel/feature/ddns-scripts-wget-user-agent

ddns-scripts: pass user agent string
lilik-openwrt-22.03
Florian Eckert 3 years ago
committed by GitHub
parent
commit
e85fa926e6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 0 deletions
  1. +7
    -0
      net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh
  2. +5
    -0
      net/ddns-scripts/samples/ddns.config_sample

+ 7
- 0
net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_functions.sh View File

@ -745,6 +745,13 @@ do_transfer() {
# disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set) # disable proxy if no set (there might be .wgetrc or .curlrc or wrong environment set)
[ -z "$proxy" ] && __PROG="$__PROG --no-proxy" [ -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 __RUNPROG="$__PROG '$__URL'" # build final command
__PROG="GNU Wget" # reuse for error logging __PROG="GNU Wget" # reuse for error logging


+ 5
- 0
net/ddns-scripts/samples/ddns.config_sample View File

@ -221,6 +221,11 @@ config service "myddns"
# option ip_source "script" # option ip_source "script"
# option ip_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 # force_ipversion option will set the "-4" respectively "-6" parameter
# on command line of transfer and DNS lookup program. # on command line of transfer and DNS lookup program.


Loading…
Cancel
Save