[interchange] Update RobotUA to use new routine to extract high-priority RobotUA

David Christensen interchange-cvs at icdevgroup.org
Tue Jan 17 22:19:01 UTC 2017


commit 348660b889132b0d1a0ea654ebb5073abb647892
Author: David Christensen <david at endpoint.com>
Date:   Tue Jan 17 16:18:13 2017 -0600

    Update RobotUA to use new routine to extract high-priority RobotUA

 lib/Vend/Config.pm |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/lib/Vend/Config.pm b/lib/Vend/Config.pm
index 4ae3c3c..7ee00f0 100644
--- a/lib/Vend/Config.pm
+++ b/lib/Vend/Config.pm
@@ -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'],
@@ -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);



More information about the interchange-cvs mailing list