Skip Menu |

This queue is for tickets about the POE-Component-Client-Keepalive CPAN distribution.

Report information
The Basics
Id: 41326
Status: resolved
Priority: 0/
Queue: POE-Component-Client-Keepalive

People
Owner: Nobody in particular
Requestors: chris [...] bingosnet.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Re: PoCo::Client::Keepalive and dotted quads
Date: Tue, 29 Jul 2008 08:36:23 +0100
To: poe [...] perl.org
From: Kidney Bingos <chris [...] bingosnet.co.uk>
On Mon, Jul 28, 2008 at 05:13:17PM -0700, J.G.Konrad wrote: Show quoted text
> 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 ==========================
While Net::IP::ip_is_ipv4() may be robust, we're actually looking for a subset of legal IPv4 addresses. For example, we don't want this one: % perl -wle 'use Net::IP qw(ip_is_ipv4); print ip_is_ipv4("127")' 1
Using Net::IP as of revision 106. Also counting the dots to make sure it's a quad.