Re: Solution for $r->connection->client_addr->port
Gazzali Jaleel <[email protected]>
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <[email protected]> |
On 2/25/2019 2:57 PM, Randolf Richardson wrote: >> On 2/25/2019 2:28 PM, Randolf Richardson wrote: >>> [sNip] >>>>> As long as one isn't relying on the client's dynamic TCP port number >>>>> from $r->connection->remote_addr->port for anything (as I've >>>>> discovered no longer works in the current release of mod_perl2), >>>>> updating to the newest mod_perl2 should ultimately be relatively >>>>> problem-free. (This client port number business has not been a high >>>>> priority for me to raise as an issue, but if it is something that >>>>> Hans or anyone else is needing I'll gladly chime in with my vote for >>>>> wanting it fixed.) >>>> >>>> Does this work for you? >>>> $r->connection->client_addr->port; >>> >>> Unfortunately, this does not work for me, and this error is appended >>> to the web server's error log: >>> >>> Can't locate object method "port" via package "APR::SockAddr" at >>> /internet/com/example/www/test.pl line 42. >> >> Does test.pl load APR::SockAddr? > > No, it wasn't. > >> use APR::SockAddr (); > > Adding that line resolves the problem, and shows the correct dynamic > port number. > > This is great! Thank you. > Sure thing, glad it works. I suppose the Apache2::Connection documentation should be updated, so that 'remote_addr' is replaced by the correct 'client_addr'. >>>> The doc. states remote_addr returns an APR::SockAddr object but there's >>>> no remote_addr in my Apache2::Connection. However, there's a client_addr >>>> which does return an APR::SockAddr object. >>> >>> In case you're interested, these are the relevant modules I'm using >>> (output filtered from "apt" on Ubuntu Linux 18.04 LTS on my laptop): >>> >>> apache2/bionic-updates,now 2.4.29-1ubuntu4.5 amd64 >>> >>> apache2-bin/bionic-updates,now 2.4.29-1ubuntu4.5 amd64 >>> >>> apache2-data/bionic-updates,bionic-updates,now 2.4.29-1ubuntu4.5 >>> all >>> >>> apache2-dev/bionic-updates,now 2.4.29-1ubuntu4.5 amd64 >>> >>> libapache2-mod-apreq2/bionic,now 2.13-5build3 amd64 >>> >>> libapache2-mod-perl2/bionic-updates,bionic-security,now >>> 2.0.10-2ubuntu3.18.04.1 amd64 >>> >>> libapache2-request-perl/bionic,now 2.13-5build3 amd64 >>> >>> perl/bionic-updates,bionic-security,now 5.26.1-6ubuntu0.3 amd64 >>> >>> perl-base/bionic-updates,bionic-security,now 5.26.1-6ubuntu0.3 >>> amd64 > > Randolf Richardson - [email protected] > Inter-Corporate Computer & Network Services, Inc. > Beautiful British Columbia, Canada > http://www.inter-corporate.com/ > > >