When added these code in my handler:
my $r = shift;
# We decline to handle subrequests: otherwise, a few lines down we
# could get into an infinite loop.
return DECLINED unless $r->is_initial_req;
#
# for limit-ip-conn
#
my $ip_count = 0;
my $limit = $r->dir_config('MaxConnPerIP') || 0;
my $ip = $r->connection->remote_ip;
my $host = $r->connection->remote_host;
my $image = Apache::Scoreboard->image;
for (my $parent = $image->parent; $parent; $parent = $parent->next) {
my $server = $parent->server;
next if ($server->status =~ /^[\._SL]$/);
if (($ip eq $server->client) or ($host eq $server->client)) {
$ip_count++;
}
}
if ($ip_count > $limit and $limit) {
$r->log_reason("Client exceeded connection limit.", $r->filename);
return FORBIDDEN;
}
I got many warnings in error_log:
Use of uninitialized value in string eq at /opt/apache1.3/run/DLAuth.pm line 42.
at /opt/apache1.3/run/DLAuth.pm line 42
DLAuth::handler('Apache=SCALAR(0x91cbe8c)') called at /dev/null line 0
eval {...} called at /dev/null line 0
The line 42 is:
if (($ip eq $server->client) or ($host eq $server->client)) {
And the handler (PerlAccessHandler) seems work not correctly.
Please guide, thanks.