noip: Simplify response processing
This commit is contained in:
parent
5b433c3cd5
commit
c0b28f344f
1 changed files with 36 additions and 46 deletions
20
ddclient.in
20
ddclient.in
|
@ -4123,19 +4123,12 @@ sub nic_noip_update {
|
|||
password => $groupcfg{'password'},
|
||||
);
|
||||
next if !header_ok($hosts, $reply);
|
||||
|
||||
my @reply = split /\n/, $reply;
|
||||
my $state = 'header';
|
||||
(my $body = $reply) =~ s/^.*?\n\n//s or do {
|
||||
failed("updating %s: Could not connect to %s.", $hosts, $groupcfg{'server'});
|
||||
next;
|
||||
};
|
||||
my @reply = split(/\n/, $body);
|
||||
for my $line (@reply) {
|
||||
if ($state eq 'header') {
|
||||
$state = 'body';
|
||||
|
||||
} elsif ($state eq 'body') {
|
||||
$state = 'results' if $line eq '';
|
||||
|
||||
} elsif ($state =~ /^results/) {
|
||||
$state = 'results2';
|
||||
|
||||
my ($status, $returnedips) = split / /, lc $line;
|
||||
my $h = shift @hosts;
|
||||
|
||||
|
@ -4185,9 +4178,6 @@ sub nic_noip_update {
|
|||
}
|
||||
}
|
||||
}
|
||||
failed("updating %s: Could not connect to %s.", $hosts, $groupcfg{'server'})
|
||||
if $state ne 'results2';
|
||||
}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
|
|
Loading…
Reference in a new issue