gandi: Use an array for headers for readability
This commit is contained in:
parent
a890b08935
commit
5e52f728ad
1 changed files with 5 additions and 5 deletions
10
ddclient.in
10
ddclient.in
|
|
@ -6910,18 +6910,18 @@ sub nic_gandi_update {
|
||||||
my $ip = delete $config{$h}{"want$ipv"} or next;
|
my $ip = delete $config{$h}{"want$ipv"} or next;
|
||||||
(my $hostname = $h) =~ s/\.\Q$config{$h}{zone}\E$//;
|
(my $hostname = $h) =~ s/\.\Q$config{$h}{zone}\E$//;
|
||||||
info("$h: setting IP address to $ip");
|
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) {
|
if ($config{$h}{'use-personal-access-token'} == 1) {
|
||||||
$headers .= "Authorization: Bearer $config{$h}{'password'}\n";
|
push(@headers, "Authorization: Bearer $config{$h}{'password'}");
|
||||||
} else {
|
} else {
|
||||||
$headers .= "Authorization: Apikey $config{$h}{'password'}\n";
|
push(@headers, "Authorization: Apikey $config{$h}{'password'}");
|
||||||
}
|
}
|
||||||
my $rrset_type = $ipv eq 'ipv6' ? 'AAAA' : 'A';
|
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 $url = "https://$config{$h}{'server'}$config{$h}{'script'}/livedns/domains/$config{$h}{'zone'}/records/$hostname/$rrset_type";
|
||||||
my $reply = geturl(
|
my $reply = geturl(
|
||||||
proxy => opt('proxy'),
|
proxy => opt('proxy'),
|
||||||
url => $url,
|
url => $url,
|
||||||
headers => $headers,
|
headers => \@headers,
|
||||||
method => 'GET',
|
method => 'GET',
|
||||||
);
|
);
|
||||||
next if !header_ok($h, $reply);
|
next if !header_ok($h, $reply);
|
||||||
|
|
@ -6947,7 +6947,7 @@ sub nic_gandi_update {
|
||||||
$reply = geturl(
|
$reply = geturl(
|
||||||
proxy => opt('proxy'),
|
proxy => opt('proxy'),
|
||||||
url => $url,
|
url => $url,
|
||||||
headers => $headers,
|
headers => \@headers,
|
||||||
method => 'PUT',
|
method => 'PUT',
|
||||||
data => $data,
|
data => $data,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue