Skip to content

Commit

Permalink
Update RobotUA to use new routine to extract high-priority RobotUA
Browse files Browse the repository at this point in the history
  • Loading branch information
David Christensen committed Jan 17, 2017
1 parent 12928a3 commit 348660b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion lib/Vend/Config.pm
Expand Up @@ -485,7 +485,7 @@ sub global_directives {
['AcrossLocks', 'yesno', 'No'],
['DNSBL', 'array', ''],
['NotRobotUA', 'list_wildcard', ''],
['RobotUA', 'list_wildcard', ''],
['RobotUA', 'list_robotua', ''],
['RobotIP', 'list_wildcard_full', ''],
['RobotHost', 'list_wildcard_full', ''],
['HostnameLookups', 'yesno', 'No'],
Expand Down Expand Up @@ -3850,6 +3850,20 @@ sub parse_array_complete {
$c;
}

sub parse_list_robotua {
my $value = get_wildcard_list(@_,0);
return '' unless length($value);

# set any high-priority "Final" RobotUA based on prefixed "!!"; note that we are setting a global as a side-effect here!
my @always_robots = ($value =~ m/!!(.*?)(?:\||$)/xg);

if (@always_robots) {
$Global::RobotUAFinal = do { for (join '|' => @always_robots) { qr/$_/ } };
}

return qr/$value/i;
}

sub parse_list_wildcard {
my $value = get_wildcard_list(@_,0);
return '' unless length($value);
Expand Down

0 comments on commit 348660b

Please sign in to comment.