[interchange-cvs] interchange - heins modified 2 files

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Fri Apr 30 16:09:39 EDT 2004


User:      heins
Date:      2004-04-30 20:09:39 GMT
Modified:  lib/Vend Config.pm Server.pm
Log:
* Add NotRobotUA directive, which allows setting of UserAgent strings
  that are not to be treated as a robot.

* Change scan order to do IP first, to be able to block robots by
  address range regardless of their UA.

Revision  Changes    Path
2.140     +3 -2      interchange/lib/Vend/Config.pm


rev 2.140, prev_rev 2.139
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.139
retrieving revision 2.140
diff -u -r2.139 -r2.140
--- Config.pm	16 Apr 2004 16:31:04 -0000	2.139
+++ Config.pm	30 Apr 2004 20:09:38 -0000	2.140
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.139 2004/04/16 16:31:04 mheins Exp $
+# $Id: Config.pm,v 2.140 2004/04/30 20:09:38 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -48,7 +48,7 @@
 use Vend::File;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.139 $, 10);
+$VERSION = substr(q$Revision: 2.140 $, 10);
 
 my %CDname;
 my %CPname;
@@ -329,6 +329,7 @@
 	['TrustProxy',		 'list_wildcard_full', ''],
 	['AcrossLocks',		 'yesno',            'No'],
     ['DNSBL',            'array',            ''],
+	['NotRobotUA',		 'list_wildcard',      ''],
 	['RobotUA',			 'list_wildcard',      ''],
 	['RobotIP',			 'list_wildcard_full', ''],
 	['RobotHost',		 'list_wildcard_full', ''],



2.52      +10 -7     interchange/lib/Vend/Server.pm


rev 2.52, prev_rev 2.51
Index: Server.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Server.pm,v
retrieving revision 2.51
retrieving revision 2.52
diff -u -r2.51 -r2.52
--- Server.pm	30 Apr 2004 19:23:07 -0000	2.51
+++ Server.pm	30 Apr 2004 20:09:39 -0000	2.52
@@ -1,6 +1,6 @@
 # Vend::Server - Listen for Interchange CGI requests as a background server
 #
-# $Id: Server.pm,v 2.51 2004/04/30 19:23:07 mheins Exp $
+# $Id: Server.pm,v 2.52 2004/04/30 20:09:39 mheins Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -26,7 +26,7 @@
 package Vend::Server;
 
 use vars qw($VERSION);
-$VERSION = substr(q$Revision: 2.51 $, 10);
+$VERSION = substr(q$Revision: 2.52 $, 10);
 
 use POSIX qw(setsid strftime);
 use Vend::Util;
@@ -260,11 +260,7 @@
 	return if $CGI::values{mv_tmp_session};
 
 #::logDebug("Check robot UA=$Global::RobotUA IP=$Global::RobotIP");
-	if ($Global::RobotUA and $CGI::useragent =~ $Global::RobotUA) {
-#::logDebug("It is a robot by UA!");
-		$CGI::values{mv_tmp_session} = 1;
-	}
-	elsif ($Global::RobotIP and $CGI::remote_addr =~ $Global::RobotIP) {
+	if ($Global::RobotIP and $CGI::remote_addr =~ $Global::RobotIP) {
 #::logDebug("It is a robot by IP!");
 		$CGI::values{mv_tmp_session} = 1;
 	}
@@ -277,6 +273,13 @@
 #::logDebug("It is a robot by host!");
 			$CGI::values{mv_tmp_session} = 1;
 		}
+	}
+	elsif ($Global::NotRobotUA and $CGI::useragent =~ $Global::NotRobotUA) {
+		# do nothing
+	}
+	elsif ($Global::RobotUA and $CGI::useragent =~ $Global::RobotUA) {
+#::logDebug("It is a robot by UA!");
+		$CGI::values{mv_tmp_session} = 1;
 	}
 }
 








More information about the interchange-cvs mailing list