On Wednesday 12 December 2007 11:36:34 pm Jeff Pang wrote:
> 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;
> }
Just to confirm, you do have a "use Apache::Scoreboard" in there somewhere?
> 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)) {
What are the values of $ip, $host and $server->client at that point?
The "uninitialised value" could be any of the above.
> And the handler (PerlAccessHandler) seems work not correctly.
Does it work as a perl request handler? (PerlHandler for mp2).
Can you get any values at all out of the ServerScore instance?