header_ok: Fail if the reply is falsy
This commit is contained in:
parent
8e24c92b1e
commit
7d99da77cc
1 changed files with 4 additions and 0 deletions
|
@ -3791,6 +3791,10 @@ sub nic_updateable {
|
||||||
######################################################################
|
######################################################################
|
||||||
sub header_ok {
|
sub header_ok {
|
||||||
my ($host, $line) = @_;
|
my ($host, $line) = @_;
|
||||||
|
if (!$line) {
|
||||||
|
failed("updating %s: no response from server", $host);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
$line =~ s/\r?\n.*//s;
|
$line =~ s/\r?\n.*//s;
|
||||||
my ($code, $msg) = ($line =~ qr%^\s*HTTP/.*\s+(\d+)\s*(?:\s+([^\s].*))?$%i);
|
my ($code, $msg) = ($line =~ qr%^\s*HTTP/.*\s+(\d+)\s*(?:\s+([^\s].*))?$%i);
|
||||||
if (!defined($code)) {
|
if (!defined($code)) {
|
||||||
|
|
Loading…
Reference in a new issue