[interchange-cvs] interchange - heins modified 3 files
interchange-core@icdevgroup.org
interchange-core@icdevgroup.org
Sat Sep 7 16:06:01 2002
User: heins
Date: 2002-09-07 20:05:13 GMT
Modified: lib/Vend Config.pm Server.pm
Modified: scripts interchange.PL
Log:
* Add robot tolerance facility, where mv_tmp_session is set when either
a RobotUA or RobotIP wildcard matches.
In interchange.cfg:
RobotUA Inktomi, Scooter, Site*Sucker
RobotIP 209.135.65, 64.172.5
After that, it is all automatic. mv_tmp_session gets set to one, the
Scratch values mv_no_session_id and mv_no_count are set to one, and
normal pages don't get IDs put out by area.
What this will do for the user:
1. Allow those UAs to follow a URL.
2. Prevent useless session files from cluttering disk
3. Prevent session writes from inhibiting disk performance.
We should probably allow a Profile to be run based on a Robot match
too. I will think about that.
Revision Changes Path
2.70 +26 -2 interchange/lib/Vend/Config.pm
rev 2.70, prev_rev 2.69
Index: Config.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.69
retrieving revision 2.70
diff -u -r2.69 -r2.70
--- Config.pm 1 Sep 2002 14:47:19 -0000 2.69
+++ Config.pm 7 Sep 2002 20:05:10 -0000 2.70
@@ -1,6 +1,6 @@
# Vend::Config - Configure Interchange
#
-# $Id: Config.pm,v 2.69 2002/09/01 14:47:19 mheins Exp $
+# $Id: Config.pm,v 2.70 2002/09/07 20:05:10 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -44,7 +44,7 @@
use Vend::Parse;
use Vend::Util;
=20
-$VERSION =3D substr(q$Revision: 2.69 $, 10);
+$VERSION =3D substr(q$Revision: 2.70 $, 10);
=20
my %CDname;
=20
@@ -288,6 +288,8 @@
['TemplateDir', 'root_dir_array', ''],
['DomainTail', 'yesno', 'Yes'],
['AcrossLocks', 'yesno', 'No'],
+ ['RobotIP', 'list_wildcard', ''],
+ ['RobotUA', 'list_wildcard', ''],
['TolerateGet', 'yesno', 'No'],
['PIDcheck', 'integer', '0'],
['LockoutCommand', undef, ''],
@@ -2255,9 +2257,31 @@
=20
$c;
}
+
+sub parse_list_wildcard {
+ my($var, $value) =3D @_;
+ return '' if ! $value;
+
+ if($value !~ /\|/) {
+ my @items =3D split /\s*,\s*/, $value;
+ my $iplist =3D $value =3D~ /^[\d.,\s]+$/;
+ for(@items) {
+ s/\./\\./g;
+ s/\*/.*/g;
+ s/\?/./g;
+ s/\s+/\\s+/g;
+ s/^/^/ if $iplist;
+ }
+ $value =3D join '|', @items;
+ }
+ $value =3D parse_regex($var, $value);
+ return qr/$value/;
+}
+
# Make a dos-ish regex into a Perl regex, check for errors
sub parse_wildcard {
my($var, $value) =3D @_;
+ return '' if ! $value;
=20
$value =3D~ s/\./\\./g;
$value =3D~ s/\*/.*/g;
2.13 +13 -3 interchange/lib/Vend/Server.pm
rev 2.13, prev_rev 2.12
Index: Server.pm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/lib/Vend/Server.pm,v
retrieving revision 2.12
retrieving revision 2.13
diff -u -r2.12 -r2.13
--- Server.pm 1 Sep 2002 13:13:43 -0000 2.12
+++ Server.pm 7 Sep 2002 20:05:10 -0000 2.13
@@ -1,6 +1,6 @@
# Vend::Server - Listen for Interchange CGI requests as a background server
#
-# $Id: Server.pm,v 2.12 2002/09/01 13:13:43 mheins Exp $
+# $Id: Server.pm,v 2.13 2002/09/07 20:05:10 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
#
@@ -25,7 +25,7 @@
package Vend::Server;
=20
use vars qw($VERSION);
-$VERSION =3D substr(q$Revision: 2.12 $, 10);
+$VERSION =3D substr(q$Revision: 2.13 $, 10);
=20
use POSIX qw(setsid strftime);
use Vend::Util;
@@ -193,12 +193,22 @@
? ($g->{IV}, $g->{VN}, $g->{IgnoreMultiple})
: ($Global::IV, $Global::VN, $Global::IgnoreMultiple);
=20
+#::logDebug("Check robot UA=3D$Global::RobotUA IP=3D$Global::RobotIP");
+ if ($Global::RobotUA and $CGI::useragent =3D~ $Global::RobotUA) {
+#::logDebug("It is a robot by UA!");
+ $CGI::values{mv_tmp_session} =3D 1;
+ }
+ elsif ($Global::RobotIP and $CGI::remote_addr =3D~ $Global::RobotIP) {
+#::logDebug("It is a robot by IP!");
+ $CGI::values{mv_tmp_session} =3D 1;
+ }
+
# Vend::ModPerl has already handled GET/POST parsing
return if $Global::mod_perl;
=20
#::logDebug("CGI::query_string=3D" . $CGI::query_string);
#::logDebug("entity=3D" . ${$h->{entity}});
- undef %CGI::values;
+
if ("\U$CGI::request_method" eq 'POST') {
parse_post(\$CGI::query_string)
if $Global::TolerateGet;
2.55 +9 -2 interchange/scripts/interchange.PL
rev 2.55, prev_rev 2.54
Index: interchange.PL
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /var/cvs/interchange/scripts/interchange.PL,v
retrieving revision 2.54
retrieving revision 2.55
diff -u -r2.54 -r2.55
--- interchange.PL 2 Sep 2002 00:52:29 -0000 2.54
+++ interchange.PL 7 Sep 2002 20:05:12 -0000 2.55
@@ -3,7 +3,7 @@
#
# Interchange version 4.9.3
#
-# $Id: interchange.PL,v 2.54 2002/09/02 00:52:29 mheins Exp $
+# $Id: interchange.PL,v 2.55 2002/09/07 20:05:12 mheins Exp $
#
# Copyright (C) 1996-2002 Red Hat, Inc. and others.
# http://www.icdevgroup.org/
@@ -1647,7 +1647,11 @@
return undef;
}
=20
- return $c if defined $g->{'base'};
+ if (defined $g->{base}) {
+ open_database(1);
+ dump_structure($c, $g->{name}) if $Global::DumpStructure;
+ return $c;
+ }
=20
eval {
$Vend::Cfg =3D $c;=09
@@ -2050,9 +2054,12 @@
$::Instance->{CookieName} =3D $Vend::Cfg->{CookieName};
=20
if($CGI::values{mv_tmp_session}) {
+#::logDebug("setting tmp_session");
$Vend::tmp_session =3D $Vend::new_session =3D 1;
$sessionid =3D 'nsession';
$Vend::Cookie =3D 1;
+ $Vend::Cfg->{ScratchDefault}{mv_no_count} =3D 1;
+ $Vend::Cfg->{ScratchDefault}{mv_no_session_id} =3D 1;
}
elsif ($::Instance->{CookieName} and defined $CGI::cookie) {
$CGI::cookie =3D~ m{$::Instance->{CookieName}=3D($Vend::Cfg->{CookiePatt=
ern})};