From 5e52f728ada5f9b53009978641de354d6f542d8e Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 28 Jul 2024 02:02:45 -0400 Subject: [PATCH] gandi: Use an array for headers for readability --- ddclient.in | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ddclient.in b/ddclient.in index a95b149..60bbcdf 100755 --- a/ddclient.in +++ b/ddclient.in @@ -6910,18 +6910,18 @@ sub nic_gandi_update { my $ip = delete $config{$h}{"want$ipv"} or next; (my $hostname = $h) =~ s/\.\Q$config{$h}{zone}\E$//; info("$h: setting IP address to $ip"); - my $headers = "Content-Type: application/json\n"; + my @headers = ('Content-Type: application/json'); if ($config{$h}{'use-personal-access-token'} == 1) { - $headers .= "Authorization: Bearer $config{$h}{'password'}\n"; + push(@headers, "Authorization: Bearer $config{$h}{'password'}"); } else { - $headers .= "Authorization: Apikey $config{$h}{'password'}\n"; + push(@headers, "Authorization: Apikey $config{$h}{'password'}"); } my $rrset_type = $ipv eq 'ipv6' ? 'AAAA' : 'A'; my $url = "https://$config{$h}{'server'}$config{$h}{'script'}/livedns/domains/$config{$h}{'zone'}/records/$hostname/$rrset_type"; my $reply = geturl( proxy => opt('proxy'), url => $url, - headers => $headers, + headers => \@headers, method => 'GET', ); next if !header_ok($h, $reply); @@ -6947,7 +6947,7 @@ sub nic_gandi_update { $reply = geturl( proxy => opt('proxy'), url => $url, - headers => $headers, + headers => \@headers, method => 'PUT', data => $data, );