From 563dc2de686d28fb38e0b297828bfdaab1b6793c Mon Sep 17 00:00:00 2001 From: Matthew Ogilvie Date: Fri, 16 Dec 2022 16:20:24 -0700 Subject: [PATCH] allow protocol to always override ssl in geturl() Signed-off-by: Matthew Ogilvie --- ddclient.in | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ddclient.in b/ddclient.in index 3df624d..0d16a8a 100755 --- a/ddclient.in +++ b/ddclient.in @@ -2432,20 +2432,26 @@ sub fetch_via_socket_io { my ($peer, $server, $port, $default_port, $use_ssl); my ($sd, $request, $reply); - ## canonify proxy and url - my $force_ssl; - $force_ssl = 1 if ($url =~ /^https:/); + ## canonify use_ssl, proxy and url + if ($url =~ /^https:/) { + $use_ssl = 1; + } elsif ($url =~ /^http:/) { + $use_ssl = 0; + } elsif ($globals{'ssl'} && !($params{ignore_ssl_option} // 0)) { + $use_ssl = 1; + } else { + $use_ssl = 0; + } + $proxy =~ s%^https?://%%i if defined($proxy); $url =~ s%^https?://%%i; $server = $url; $server =~ s%[?/].*%%; $url =~ s%^[^?/]*/?%%; - if ($force_ssl || ($globals{'ssl'} && !($params{ignore_ssl_option} // 0))) { - $use_ssl = 1; + if ($use_ssl) { $default_port = '443'; } else { - $use_ssl = 0; $default_port = '80'; } debug("proxy = %s", $proxy // '');