diff --git a/ddclient.in b/ddclient.in index 2509bc1..09f6422 100755 --- a/ddclient.in +++ b/ddclient.in @@ -4016,10 +4016,7 @@ sub dnsexit2_update_host { update => \@updates, }), ); - if (!header_ok($h, $reply)) { - failed("$h: request to $url failed"); - return; - } + return if !header_ok($h, $reply); (my $body = $reply) =~ s/^.*?\r?\n\r?\n//s; my $response = eval { decode_json($body); }; if (ref($response) ne 'HASH') { @@ -5155,8 +5152,6 @@ sub nic_freedns_update { warning("REPLIED: %s", $reply); failed("updating %s: Invalid reply.", $h); } - } else { - failed("updating %s: Could not connect to %s.", $h, $url_tmpl); } } } @@ -5569,8 +5564,6 @@ sub nic_mythicdyn_update { $config{$h}{"status-ipv$mythver"} = "good"; success("%s -- IPV%s Updated successfully.", $h, $mythver); - } else { - failed("%s -- Failed to update.", $h); } } else { info("No configuration for IPV%s -------------", $mythver); @@ -5771,11 +5764,7 @@ sub nic_cloudflare_update { url => $url, headers => $headers ); - unless (header_ok($domain, $reply)) { - failed("updating %s: Could not connect to %s.", $domain, $config{$domain}{'server'}); - next; - } - + next if !header_ok($domain, $reply); # Strip header $reply =~ qr/{(?:[^{}]*|(?R))*}/mp; my $response = eval {decode_json(${^MATCH})}; @@ -5809,10 +5798,7 @@ sub nic_cloudflare_update { url => $url, headers => $headers ); - unless (header_ok($domain, $reply)) { - failed("updating %s: Could not connect to %s.", $domain, $config{$domain}{'server'}); - next; - } + next if !header_ok($domain, $reply); # Strip header $reply =~ qr/{(?:[^{}]*|(?R))*}/mp; $response = eval {decode_json(${^MATCH})}; @@ -5836,10 +5822,7 @@ sub nic_cloudflare_update { method => "PATCH", data => $data ); - unless (header_ok($domain, $reply)) { - failed("updating %s: Could not connect to %s.", $domain, $config{$domain}{'server'}); - next; - } + next if !header_ok($domain, $reply); # Strip header $reply =~ qr/{(?:[^{}]*|(?R))*}/mp; $response = eval {decode_json(${^MATCH})}; @@ -5904,11 +5887,7 @@ sub nic_hetzner_update { url => $url, headers => $headers ); - unless (header_ok($domain, $reply)) { - failed("updating %s: Could not connect to %s.", $domain, $config{$domain}{'server'}); - next; - } - + next if !header_ok($domain, $reply); # Strip header $reply =~ qr/{(?:[^{}]*|(?R))*}/mp; my $response = eval {decode_json(${^MATCH})}; @@ -5940,10 +5919,7 @@ sub nic_hetzner_update { url => $url, headers => $headers ); - unless (header_ok($domain, $reply)) { - failed("updating %s: Could not connect to %s.", $domain, $config{$domain}{'server'}); - next; - } + next if !header_ok($domain, $reply); # Strip header $reply =~ qr/{(?:[^{}]*|(?R))*}/mp; $response = eval {decode_json(${^MATCH})}; @@ -5974,10 +5950,7 @@ sub nic_hetzner_update { method => $http_method, data => $data ); - unless (header_ok($domain, $reply)) { - failed("updating %s: Could not connect to %s.", $domain, $config{$domain}{'server'}); - next; - } + next if !header_ok($domain, $reply); # Strip header $reply =~ qr/{(?:[^{}]*|(?R))*}/mp; $response = eval {decode_json(${^MATCH})}; @@ -6722,10 +6695,7 @@ sub nic_porkbun_update { apikey => $config{$h}{'apikey'}, }), ); - if (!header_ok($h, $reply)) { - failed("$h: $reply"); - next; - } + next if !header_ok($h, $reply); (my $body = $reply) =~ s/^.*?\n\n//s; $body =~ qr/{(?:[^{}]*|(?R))*}/mp; my $response = eval { decode_json(${^MATCH}) }; @@ -6766,10 +6736,7 @@ sub nic_porkbun_update { notes => $notes, }), ); - if (!header_ok($h, $reply)) { - failed("$h: $reply"); - next; - } + next if !header_ok($h, $reply); $config{$h}{"status-ipv$ipv"} = "good"; success("$h: IPv%s address set to $ip"); } @@ -6820,11 +6787,7 @@ sub nic_cloudns_update { url => $dynurl . '&proxy=1', headers => "X-Forwarded-For: $ip\n", ); - if (!header_ok($hosts, $reply)) { - $config{$_}{'status'} = 'failed' for @hosts; - failed("updating %s: failed to visit DynURL", $hosts); - next; - } + next if !header_ok($hosts, $reply); $reply =~ s/^.*?\n\n//s; # Strip the headers. chomp($reply); if ($reply eq "The record's key is wrong!" || $reply eq "Invalid request.") { @@ -7278,11 +7241,7 @@ sub nic_digitalocean_update_one { url => $list_url, headers => $headers, ); - unless (header_ok($h, $list_resp)) { - $config{$h}{"status-$ipv"} = 'failed'; - failed("listing %s %s: Failed connection or bad response from %s.", $h, $ipv, $server); - return; - } + return if !header_ok($h, $list_resp); $list_resp =~ s/^.*?\n\n//s; # Strip header my $list = eval { decode_json($list_resp) }; @@ -7315,11 +7274,7 @@ sub nic_digitalocean_update_one { headers => $headers, data => $update_data, ); - unless (header_ok($h, $update_resp)) { - $config{$h}{"status-$ipv"} = 'failed'; - failed("updating %s %s: Failed connection or bad response from %s.", $h, $ipv, $server); - return; - } + return if !header_ok($h, $update_resp); } $config{$h}{"status-$ipv"} = 'good';