diff --git a/Changes b/Changes index 188f38f..9644a9a 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,7 @@ Revision history for CGI-Info Added documentroot() as a synonym to rootdir() For compatability with Apache Allow "use lib CGI::Info::script_dir() . '../lib';" + Mark Facebook as a search engine, not a robot 0.79 Wed Jan 3 14:25:42 EST 2024 Better arg count checking diff --git a/lib/CGI/Info.pm b/lib/CGI/Info.pm index 307bbb1..4d2148a 100644 --- a/lib/CGI/Info.pm +++ b/lib/CGI/Info.pm @@ -1471,6 +1471,16 @@ sub is_robot { } } + # Don't use HTTP_USER_AGENT to detect more than we really have to since + # that is easily spoofed + if($agent =~ /www\.majestic12\.co\.uk|facebookexternal/) { + # Mark Facebook as a search engine, not a robot + if($self->{cache}) { + $self->{cache}->set($key, 'search', '1 day'); + } + return 0; + } + unless($self->{browser_detect}) { if(eval { require HTTP::BrowserDetect; }) { HTTP::BrowserDetect->import();