Explicitly tell geturl to ignore the global ssl option

Changing behavior based on the identity of the caller is fragile and
makes the code difficult to understand.
This commit is contained in:
Richard Hansen 2020-07-06 20:14:16 -04:00
parent 2e5db5af44
commit 7921c53605

View file

@ -1986,8 +1986,7 @@ sub geturl {
opt('fw') && debug("opt(fw = %s)", opt('fw')); opt('fw') && debug("opt(fw = %s)", opt('fw'));
$globals{'fw'} && debug("glo fw = %s", $globals{'fw'}); $globals{'fw'} && debug("glo fw = %s", $globals{'fw'});
## always omit SSL for connections to local router if ($force_ssl || ($globals{'ssl'} && !($params->{ignore_ssl_option} // 0))) {
if ($force_ssl || ($globals{'ssl'} && ((caller(1))[3] // '') ne 'ddclient::get_ip')) {
$use_ssl = 1; $use_ssl = 1;
$default_port = '443'; $default_port = '443';
} else { } else {
@ -2167,7 +2166,11 @@ sub get_ip {
$arg = $url; $arg = $url;
if ($url) { if ($url) {
$reply = geturl({ proxy => opt('proxy', $h), url => $url }) || ''; $reply = geturl({
proxy => opt('proxy', $h),
url => $url,
ignore_ssl_option => 1,
}) || '';
} }
} elsif (($use eq 'cisco')) { } elsif (($use eq 'cisco')) {
@ -2188,6 +2191,7 @@ sub get_ip {
url => $url, url => $url,
login => opt('fw-login', $h), login => opt('fw-login', $h),
password => opt('fw-password', $h), password => opt('fw-password', $h),
ignore_ssl_option => 1,
}) || ''; }) || '';
$arg = $url; $arg = $url;
@ -2209,6 +2213,7 @@ sub get_ip {
url => $url, url => $url,
login => opt('fw-login', $h), login => opt('fw-login', $h),
password => opt('fw-password', $h), password => opt('fw-password', $h),
ignore_ssl_option => 1,
}) || ''; }) || '';
$arg = $url; $arg = $url;
@ -2227,6 +2232,7 @@ sub get_ip {
url => $url, url => $url,
login => opt('fw-login', $h), login => opt('fw-login', $h),
password => opt('fw-password', $h), password => opt('fw-password', $h),
ignore_ssl_option => 1,
}) || ''; }) || '';
} }
} }