#577 fix bug related to hostnames comprised a-f only

This commit is contained in:
Oliver Gorwits
2019-05-27 13:25:58 +01:00
parent 262fa88009
commit 416cffe52a
2 changed files with 5 additions and 2 deletions

View File

@@ -68,6 +68,7 @@ Module::Build->new(
'Plack::Middleware::Expires' => '0.03',
'Plack::Middleware::ReverseProxy' => '0.15',
'Pod::Usage' => 0,
'Regexp::Common' => 2017060201,
'Role::Tiny' => '1.002005',
'Scope::Guard' => 0,
'Sereal' => '0',

View File

@@ -5,7 +5,9 @@ use strict;
use warnings;
use Try::Tiny;
use Regexp::Common 'net';
use NetAddr::IP::Lite ':lower';
require Dancer::Logger;
=head1 ADDITIONAL METHODS
@@ -84,7 +86,7 @@ sub search_aliases {
# rough approximation of IP addresses (v4 in v6 not supported).
# this helps us avoid triggering any DNS.
my $by_ip = ($q =~ m{^(?:[.0-9/]+|[:0-9a-f/]+)$}i) ? 1 : 0;
my $by_ip = ($q =~ m{^(?:$RE{net}{IPv4}|$RE{net}{IPv6})$}i) ? 1 : 0;
my $clause;
if ($by_ip) {
@@ -132,7 +134,7 @@ Returns only the first result of any found devices
=back
If not matching devices are found, C<undef> is returned.
If no matching devices are found, C<undef> is returned.
=cut