From 451a10e43688d75f37e0c282e00bd92f07a241cc Mon Sep 17 00:00:00 2001 From: Jonathan Kimmitt Date: Thu, 25 Nov 2021 12:39:03 +0000 Subject: [PATCH] Trim non JSON part of response from Cloudflare client --- ddclient.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ddclient.in b/ddclient.in index 5a35d38..14e618b 100755 --- a/ddclient.in +++ b/ddclient.in @@ -5561,7 +5561,8 @@ sub nic_cloudflare_update { } # Strip header - $reply =~ s/^.*?\n\n//s; + $reply =~ s/[^{]*//s; + $reply =~ s/[^}]*$//s; my $response = eval {decode_json($reply)}; unless ($response && $response->{result}) { failed("updating %s: invalid json or result.", $domain); @@ -5598,7 +5599,8 @@ sub nic_cloudflare_update { next; } # Strip header - $reply =~ s/^.*?\n\n//s; + $reply =~ s/[^{]*//s; + $reply =~ s/[^}]*$//s; $response = eval {decode_json($reply)}; unless ($response && $response->{result}) { failed("updating %s: invalid json or result.", $domain); @@ -5625,7 +5627,8 @@ sub nic_cloudflare_update { next; } # Strip header - $reply =~ s/^.*?\n\n//s; + $reply =~ s/[^{]*//s; + $reply =~ s/[^}]*$//s; $response = eval {decode_json($reply)}; if ($response && $response->{result}) { success("updating %s: IPv$ipv address set to %s", $domain, $ip);