Mailing List Archive

[interchange] Revert recent RobotUA changes until fully baked
commit 243f663e4a078167a573ab33344c3b118bc45a63
Author: David Christensen <david@endpoint.com>
Date: Wed Jan 18 07:04:53 2017 -0600

Revert recent RobotUA changes until fully baked

lib/Vend/Config.pm | 16 +--------
lib/Vend/Server.pm | 35 ++++++-------------
t/robot_ua.t | 91 -------------------------------------------------
t/robot_ua/ua.norobot | 1 -
t/robot_ua/ua.robot | 1 -
5 files changed, 12 insertions(+), 132 deletions(-)
---
diff --git a/lib/Vend/Config.pm b/lib/Vend/Config.pm
index 7ee00f0..4ae3c3c 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_robotua', ''],
+ ['RobotUA', 'list_wildcard', ''],
['RobotIP', 'list_wildcard_full', ''],
['RobotHost', 'list_wildcard_full', ''],
['HostnameLookups', 'yesno', 'No'],
@@ -3850,20 +3850,6 @@ 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);
diff --git a/lib/Vend/Server.pm b/lib/Vend/Server.pm
index a7eb80b..0d9c852 100644
--- a/lib/Vend/Server.pm
+++ b/lib/Vend/Server.pm
@@ -279,19 +279,10 @@ EOF
#::logDebug("request_method=$CGI::request_method");
#::logDebug("content_type=$CGI::content_type");

- $Vend::Robot = check_is_robot();
-
- $CGI::values{mv_tmp_session} ||= 1 if $Vend::Robot;
-}
-
-
-sub check_is_robot {
- my $ret = 1;
-
#::logDebug("Check robot UA=$Global::RobotUA IP=$Global::RobotIP");
if ($Global::RobotIP and $CGI::remote_addr =~ $Global::RobotIP) {
#::logDebug("It is a robot by IP!");
- $ret = 1;
+ $Vend::Robot = 1;
}
elsif ($Global::HostnameLookups && $Global::RobotHost) {
if (!$CGI::remote_host && $CGI::remote_addr) {
@@ -300,24 +291,20 @@ sub check_is_robot {
}
if ($CGI::remote_host && $CGI::remote_host =~ $Global::RobotHost) {
#::logDebug("It is a robot by host!");
- $ret = 1;
+ $Vend::Robot = 1;
}
}
- if ($Global::RobotUAFinal and $CGI::useragent =~ $Global::RobotUAFinal) {
- $ret = 1;
- }
- else {
- unless ($Vend::Robot) {
- if ($Global::NotRobotUA and $CGI::useragent =~ $Global::NotRobotUA) {
- # do nothing
- }
- elsif ($Global::RobotUA and $CGI::useragent =~ $Global::RobotUA) {
- #::logDebug("It is a robot by UA!");
- $ret = 1;
- }
+ unless ($Vend::Robot) {
+ if ($Global::NotRobotUA and $CGI::useragent =~ $Global::NotRobotUA) {
+ # do nothing
+ }
+ elsif ($Global::RobotUA and $CGI::useragent =~ $Global::RobotUA) {
+#::logDebug("It is a robot by UA!");
+ $Vend::Robot = 1;
}
}
- return $ret;
+
+ $CGI::values{mv_tmp_session} ||= 1 if $Vend::Robot;
}

# This is called by parse_multipart

_______________________________________________
interchange-cvs mailing list
interchange-cvs@icdevgroup.org
http://www.icdevgroup.org/mailman/listinfo/interchange-cvs