not parse-able.
In case the downloaded list is empty or the parser is not able to parse
it properly, the download_and_create_blocklist() function now exits and
will return "empty_list" as new error code.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
## nothing - On success
## not_modified - In case the servers responds with "Not modified" (304)
## dl_error - If the requested blocklist could not be downloaded.
+## empty_list - The downloaded blocklist is empty, or the parser was not able to parse
+## it correctly.
#
sub download_and_create_blocklist($) {
my ($list) = @_;
push(@blocklist, $address);
}
+ # Check if the content could be parsed correctly and the blocklist
+ # contains at least one item.
+ unless(@blocklist) {
+ # No entries - exit and return "empty_list".
+ return "empty_list";
+ }
+
# Get amount of entries in the blocklist array.
my $list_entries = scalar(@blocklist);