Skip to content

Commit

Permalink
Mark Facebook as a search engine, not a robot
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed Jan 18, 2024
1 parent f45a147 commit 33b1389
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions lib/CGI/Info.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 33b1389

Please sign in to comment.