Cloudflare Fix

Cloudflare was returning values not being matched properly by the regex expression.
Numbers that were not Headers.
This fix or patch should resolve that issue, by only collecting one match to JSON relevant data.
This commit is contained in:
Austin H 2021-08-17 11:44:37 -04:00
parent c44f446d34
commit 3e952e6892

View file

@ -5561,8 +5561,8 @@ sub nic_cloudflare_update {
} }
# Strip header # Strip header
$reply =~ s/^.*?\n\n//s; $reply =~ qr/{(?:[^{}]*|(?R))*}/mp;
my $response = eval {decode_json($reply)}; my $response = eval {decode_json(${^MATCH})};
unless ($response && $response->{result}) { unless ($response && $response->{result}) {
failed("updating %s: invalid json or result.", $domain); failed("updating %s: invalid json or result.", $domain);
next; next;
@ -5598,8 +5598,8 @@ sub nic_cloudflare_update {
next; next;
} }
# Strip header # Strip header
$reply =~ s/^.*?\n\n//s; $reply =~ qr/{(?:[^{}]*|(?R))*}/mp;
$response = eval {decode_json($reply)}; $response = eval {decode_json(${^MATCH})};
unless ($response && $response->{result}) { unless ($response && $response->{result}) {
failed("updating %s: invalid json or result.", $domain); failed("updating %s: invalid json or result.", $domain);
next; next;
@ -5625,8 +5625,8 @@ sub nic_cloudflare_update {
next; next;
} }
# Strip header # Strip header
$reply =~ s/^.*?\n\n//s; $reply =~ qr/{(?:[^{}]*|(?R))*}/mp;
$response = eval {decode_json($reply)}; $response = eval {decode_json(${^MATCH})};
if ($response && $response->{result}) { if ($response && $response->{result}) {
success("updating %s: IPv$ipv address set to %s", $domain, $ip); success("updating %s: IPv$ipv address set to %s", $domain, $ip);
$config{$domain}{"ipv$ipv"} = $ip; $config{$domain}{"ipv$ipv"} = $ip;