On 6/15/2015 5:02 PM, John Dunlap wrote:
I am getting the client ip address in every request and checking it against an access control list which is stored in my database(so that the user can maintain the ACL's without the assistance of an administrator). These are the code snippets which are grabbing the IP address:

==== Begin Snippet 1 ====
# Check which method is available and use the correct one. For some
# reason, remote_ip was changed to client_ip in Apache 2.4
    if ($connection->can('client_ip')) {
        $R->{remote_host} = $connection->client_ip();
    } elsif($connection->can('remote_ip')) {
        $R->{remote_host} = $connection->remote_ip();
    } else {
die("I don't know how to find the client's ip address");
    }
==== End Snippet 1 ====

==== Begin Snippet 2 ====
    if ($connection->can('client_ip')) { # Apache >= 2.4
        return $connection->client_addr->ip_get;
    } else  { # Apache <= 2.2
return $connection->remote_addr->ip_get;
    }
==== End Snippet 2 ====
Looks to me like someone has already made Apache 2.4 modifications to the code.

You might want to compile the mod perl 2.09-rc3 and test with that as I don't know what SVN version debian is working with.

regards,
KAM

Reply via email to