header_ok: Fail if the reply is falsy

This commit is contained in:
Richard Hansen 2024-06-25 22:22:02 -04:00
parent 8e24c92b1e
commit 7d99da77cc

View file

@ -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)) {