Re: PoCo::Client::Keepalive and dotted quads

Kidney Bingos <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
On Mon, Jul 28, 2008 at 05:13:17PM -0700, J.G.Konrad wrote:
> After some fun playing with the perl debugger I got down to a section of the
> PoCo::Client::Keepalive code that I think is not correct with how it handles
> dotted quads. In _ka_resolve_request() there is this code
> 
> 
>   # Skip DNS resolution if it's already a dotted quad.
>   # TODO - Not all dotted quads are good.
>   if ($host !~ /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/) {
>     DEBUG_DNS and warn "DNS: $host is a dotted quad; skipping lookup";
>     $kernel->call("$self", ka_add_to_queue => $request);
>     return;
>   }
> 
> The comments say that if it is a dotted quad then skip resolution but that
> is not happening.  I think the conditional needs to be inverted. Change the
> '!~' into a '=~'.
> 
> After I made the change in my copy of PoCo::Client::Keepalive the dotted
> quad worked as expected.

That regex does look decidedly unrobust. I'd suggest that as PoCo-Client-Keepalive 
requires PoCo-Client-DNS and that in turn requires Net::DNS, which in turn requires 
Net::IP that we use Net::IP's ip_is_ipv4() function which should be more accurate.

Cheers,

-- 
Chris Williams
aka BinGOs
PGP ID 0x4658671F
http://www.gumbynet.org.uk
==========================
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFIjsh37eyMi0ZYZx8RAoAaAJ9vuvKtO5HVNgjOGDjIaDj1svTamgCfWa7Z
QWSyZ5k3KLNhZVREAYgLGno=
=brlh
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.