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

Attachment: pgpG8OiSJSB2v.pgp
Description: PGP signature

Reply via email to