You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Steve Baldwin <st...@gmail.com> on 2014/02/09 06:49:49 UTC

Problem with Apache2::Connection::remote_ip

Hi,

Not sure what I'm doing wrong here. I'm just trying to get the client ip
address in a PerlResponseHandler as follows:

:
use Apache2::Connection;
:
    my $remote_ip = $r->connection->remote_ip();
:

I get a runtime error as follows:

[Sun Feb 09 16:44:22.499681 2014] [perl:error] [pid 3632] [client
192.168.1.105:52533] Can't locate object method "remote_ip" via package
"Apache2::Connection" at /usr/local/lib/site_perl/Storm/Dev/Handler.pm

Here are the various versions (OS = Ubuntu 13.10) :

[Sun Feb 09 16:44:01.267265 2014] [mpm_prefork:notice] [pid 3625] AH00163:
Apache/2.4.6 (Ubuntu) PHP/5.5.3-1ubuntu2.1 mod_perl/2.0.8 Perl/v5.14.2
configured -- resuming normal operations

Thanks,

Steve

Re: Problem with Apache2::Connection::remote_ip

Posted by Steve Baldwin <st...@gmail.com>.
FYI, following the Apache 2.4 API I found $r->useragent_ip gave me what I
wanted.

Steve


On Mon, Feb 10, 2014 at 7:54 AM, Steve Baldwin <st...@gmail.com>wrote:

> Thanks for that.  Yes, it would appear that the versions of apache2 and
> mod_perl 'bundled' with Ubuntu 13.10 are not exactly in sync and the
> version of mod_perl (which is the latest on CPAN afaict) has not yet caught
> up with apache 2.4.
>
> I guess the Apache2::xxx modules are 'wafer thin' layers over the apache2
> libraries so the actual API is determined by the underlying library rather
> than what the POD purports to provide.
>
> Has there been any statement of direction from the mod_perl maintainers as
> to how apache 2.4 will be supported from a 'backwards compatibility'
> perspective?  I imagine there is quite a bit of code out there that depends
> on the old API.
>
>
> On Mon, Feb 10, 2014 at 6:01 AM, Jeff Trawick <tr...@gmail.com> wrote:
>
>> On Sun, Feb 9, 2014 at 9:40 AM, Steve Hay <st...@googlemail.com>wrote:
>>
>>> On 9 February 2014 05:49, Steve Baldwin <st...@gmail.com> wrote:
>>> > Hi,
>>> >
>>> > Not sure what I'm doing wrong here. I'm just trying to get the client
>>> ip
>>> > address in a PerlResponseHandler as follows:
>>> >
>>> > :
>>> > use Apache2::Connection;
>>> > :
>>> >     my $remote_ip = $r->connection->remote_ip();
>>> > :
>>> >
>>> > I get a runtime error as follows:
>>> >
>>> > [Sun Feb 09 16:44:22.499681 2014] [perl:error] [pid 3632] [client
>>> > 192.168.1.105:52533] Can't locate object method "remote_ip" via
>>> package
>>> > "Apache2::Connection" at /usr/local/lib/site_perl/Storm/Dev/Handler.pm
>>>
>>> Is it called client_ip() now rather than remote_ip()?
>>>
>>>
>> http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html
>>
>> Search for "remote_ip" for discussion.
>>
>>
>>>
>>> >
>>> > Here are the various versions (OS = Ubuntu 13.10) :
>>> >
>>> > [Sun Feb 09 16:44:01.267265 2014] [mpm_prefork:notice] [pid 3625]
>>> AH00163:
>>> > Apache/2.4.6 (Ubuntu) PHP/5.5.3-1ubuntu2.1 mod_perl/2.0.8 Perl/v5.14.2
>>> > configured -- resuming normal operations
>>>
>>> mod_perl doesn't officially support httpd 2.4.x yet, but it's getting
>>> close now. I think some Linux distros have gone ahead with versions
>>> already, which I guess is what you're using.
>>>
>>
>>
>>
>> --
>> Born in Roswell... married an alien...
>> http://emptyhammock.com/
>>
>
>

Re: Problem with Apache2::Connection::remote_ip

Posted by Steve Baldwin <st...@gmail.com>.
Thanks for that.  Yes, it would appear that the versions of apache2 and
mod_perl 'bundled' with Ubuntu 13.10 are not exactly in sync and the
version of mod_perl (which is the latest on CPAN afaict) has not yet caught
up with apache 2.4.

I guess the Apache2::xxx modules are 'wafer thin' layers over the apache2
libraries so the actual API is determined by the underlying library rather
than what the POD purports to provide.

Has there been any statement of direction from the mod_perl maintainers as
to how apache 2.4 will be supported from a 'backwards compatibility'
perspective?  I imagine there is quite a bit of code out there that depends
on the old API.


On Mon, Feb 10, 2014 at 6:01 AM, Jeff Trawick <tr...@gmail.com> wrote:

> On Sun, Feb 9, 2014 at 9:40 AM, Steve Hay <st...@googlemail.com>wrote:
>
>> On 9 February 2014 05:49, Steve Baldwin <st...@gmail.com> wrote:
>> > Hi,
>> >
>> > Not sure what I'm doing wrong here. I'm just trying to get the client ip
>> > address in a PerlResponseHandler as follows:
>> >
>> > :
>> > use Apache2::Connection;
>> > :
>> >     my $remote_ip = $r->connection->remote_ip();
>> > :
>> >
>> > I get a runtime error as follows:
>> >
>> > [Sun Feb 09 16:44:22.499681 2014] [perl:error] [pid 3632] [client
>> > 192.168.1.105:52533] Can't locate object method "remote_ip" via package
>> > "Apache2::Connection" at /usr/local/lib/site_perl/Storm/Dev/Handler.pm
>>
>> Is it called client_ip() now rather than remote_ip()?
>>
>>
> http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html
>
> Search for "remote_ip" for discussion.
>
>
>>
>> >
>> > Here are the various versions (OS = Ubuntu 13.10) :
>> >
>> > [Sun Feb 09 16:44:01.267265 2014] [mpm_prefork:notice] [pid 3625]
>> AH00163:
>> > Apache/2.4.6 (Ubuntu) PHP/5.5.3-1ubuntu2.1 mod_perl/2.0.8 Perl/v5.14.2
>> > configured -- resuming normal operations
>>
>> mod_perl doesn't officially support httpd 2.4.x yet, but it's getting
>> close now. I think some Linux distros have gone ahead with versions
>> already, which I guess is what you're using.
>>
>
>
>
> --
> Born in Roswell... married an alien...
> http://emptyhammock.com/
>

Re: Problem with Apache2::Connection::remote_ip

Posted by Jeff Trawick <tr...@gmail.com>.
On Sun, Feb 9, 2014 at 9:40 AM, Steve Hay <st...@googlemail.com>wrote:

> On 9 February 2014 05:49, Steve Baldwin <st...@gmail.com> wrote:
> > Hi,
> >
> > Not sure what I'm doing wrong here. I'm just trying to get the client ip
> > address in a PerlResponseHandler as follows:
> >
> > :
> > use Apache2::Connection;
> > :
> >     my $remote_ip = $r->connection->remote_ip();
> > :
> >
> > I get a runtime error as follows:
> >
> > [Sun Feb 09 16:44:22.499681 2014] [perl:error] [pid 3632] [client
> > 192.168.1.105:52533] Can't locate object method "remote_ip" via package
> > "Apache2::Connection" at /usr/local/lib/site_perl/Storm/Dev/Handler.pm
>
> Is it called client_ip() now rather than remote_ip()?
>
>
http://httpd.apache.org/docs/2.4/developer/new_api_2_4.html

Search for "remote_ip" for discussion.


>
> >
> > Here are the various versions (OS = Ubuntu 13.10) :
> >
> > [Sun Feb 09 16:44:01.267265 2014] [mpm_prefork:notice] [pid 3625]
> AH00163:
> > Apache/2.4.6 (Ubuntu) PHP/5.5.3-1ubuntu2.1 mod_perl/2.0.8 Perl/v5.14.2
> > configured -- resuming normal operations
>
> mod_perl doesn't officially support httpd 2.4.x yet, but it's getting
> close now. I think some Linux distros have gone ahead with versions
> already, which I guess is what you're using.
>



-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

Re: Problem with Apache2::Connection::remote_ip

Posted by Steve Hay <st...@googlemail.com>.
On 9 February 2014 05:49, Steve Baldwin <st...@gmail.com> wrote:
> Hi,
>
> Not sure what I'm doing wrong here. I'm just trying to get the client ip
> address in a PerlResponseHandler as follows:
>
> :
> use Apache2::Connection;
> :
>     my $remote_ip = $r->connection->remote_ip();
> :
>
> I get a runtime error as follows:
>
> [Sun Feb 09 16:44:22.499681 2014] [perl:error] [pid 3632] [client
> 192.168.1.105:52533] Can't locate object method "remote_ip" via package
> "Apache2::Connection" at /usr/local/lib/site_perl/Storm/Dev/Handler.pm

Is it called client_ip() now rather than remote_ip()?


>
> Here are the various versions (OS = Ubuntu 13.10) :
>
> [Sun Feb 09 16:44:01.267265 2014] [mpm_prefork:notice] [pid 3625] AH00163:
> Apache/2.4.6 (Ubuntu) PHP/5.5.3-1ubuntu2.1 mod_perl/2.0.8 Perl/v5.14.2
> configured -- resuming normal operations

mod_perl doesn't officially support httpd 2.4.x yet, but it's getting
close now. I think some Linux distros have gone ahead with versions
already, which I guess is what you're using.

Re: Problem with Apache2::Connection::remote_ip

Posted by André Warnier <aw...@ice-sa.com>.
Steve Baldwin wrote:
> Hi,
> 
> Not sure what I'm doing wrong here. I'm just trying to get the client ip
> address in a PerlResponseHandler as follows:
> 
> :
> use Apache2::Connection;
> :
>     my $remote_ip = $r->connection->remote_ip();
> :
> 
> I get a runtime error as follows:
> 
> [Sun Feb 09 16:44:22.499681 2014] [perl:error] [pid 3632] [client
> 192.168.1.105:52533] Can't locate object method "remote_ip" via package
> "Apache2::Connection" at /usr/local/lib/site_perl/Storm/Dev/Handler.pm
> 
> Here are the various versions (OS = Ubuntu 13.10) :
> 
> [Sun Feb 09 16:44:01.267265 2014] [mpm_prefork:notice] [pid 3625] AH00163:
> Apache/2.4.6 (Ubuntu) PHP/5.5.3-1ubuntu2.1 mod_perl/2.0.8 Perl/v5.14.2
> configured -- resuming normal operations
> 

This is not going to help you much, but I can at least confirm that I do exactly the same 
as you :

			my $remote_ip = $r->connection->remote_ip || '';

in one of my mod_perl modules, and that it works several hundred times a day without 
error, under the following versions :

[Sun Feb 02 06:25:07 2014] [notice] Apache/2.2.9 (Debian) DAV/2 mod_jk/1.2.26 
mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.10.0 configured -- resuming normal operations

[Sun Feb 09 06:26:34 2014] [notice] Apache/2.2.16 (Debian) DAV/2 mod_jk/1.2.30 
mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations

[Sun Feb 09 06:26:51 2014] [notice] Apache/2.2.22 (Debian) mod_apreq2-20090110/2.8.0 
mod_perl/2.0.7 Perl/v5.14.2 configured -- resuming normal operations