Skip to content

Commit

Permalink
Catch gethostbyaddr failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Jan 30, 2021
1 parent 9cba656 commit 98b7997
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/CGI/Info.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ sub is_search_engine {
# TODO: DNS lookup, not gethostbyaddr - though that will be slow
my $hostname = gethostbyaddr(inet_aton($remote), AF_INET) || $remote;

if(($hostname =~ /google|msnbot|bingbot/) && ($hostname !~ /^google-proxy/)) {
if(defined($hostname) && ($hostname =~ /google|msnbot|bingbot/) && ($hostname !~ /^google-proxy/)) {
if($self->{_cache}) {
$self->{_cache}->set($key, 1, '1 day');
}
Expand Down

0 comments on commit 98b7997

Please sign in to comment.