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 ====


On Mon, Jun 15, 2015 at 4:58 PM, Kevin A. McGrail <kmcgr...@pccc.com> wrote:

> On 6/15/2015 4:56 PM, John Dunlap wrote:
>
>> Could that result in inconsistent request behavior? Because one of the
>> things that I'm noticing is that, for no apparent reason, sometimes I can
>> log in normally and sometimes I can't with identical request
>> parameters(even if I delete the session and restart the server in between).
>>
> Sure if there is something that tries to get the IP address of the
> connection, for example...  But I would have expected it to bomb out but
> could be eval blocks, etc.  Without error messages or code, way too much
> could be's.
>
> Regards,
> KAM
>



-- 
John Dunlap
*CTO | Lariat *

*Direct:*
*j...@lariat.co <j...@lariat.co>*

*Customer Service:*
877.268.6667
supp...@lariat.co

Reply via email to