[ic] Server.pm logic for NotRobotUA too exclusive
John Young
john_young at sonic.net
Wed Jul 7 21:35:22 EDT 2004
If the suggestion in my last message allowing for the use
of both RobotHost and RobotUA is considered worthwhile, then
it might also be good to move the RobotUA exclusion up in
order to avoid the gethostbyaddr(), which I assume is more
expensive than even a long RobotUA match list... unless
people like to see the hostname in their logs (that might
actually be useful - discussion on this would be welcome):
if ($Global::RobotIP and $CGI::remote_addr =~ $Global::RobotIP) {
#::logDebug("It is a robot by IP!");
$CGI::values{mv_tmp_session} = 1;
return;
}
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!");
$CGI::values{mv_tmp_session} = 1;
return;
}
if ($Global::HostnameLookups && $Global::RobotHost) {
if (!$CGI::remote_host && $CGI::remote_addr) {
$CGI::remote_host =
gethostbyaddr(Socket::inet_aton($CGI::remote_addr),Socket::AF_INET);
$CGI::host = $CGI::remote_host || $CGI::remote_addr;
}
if ($CGI::remote_host && $CGI::remote_host =~ $Global::RobotHost) {
#::logDebug("It is a robot by host!");
$CGI::values{mv_tmp_session} = 1;
return;
}
}
Sorry I didn't catch that in my earlier post.
John Young
More information about the interchange-users
mailing list