https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43463

--- Comment #8 from David Cook <[email protected]> ---
(In reply to Kyle M Hall (khall) from comment #6)
> Created attachment 207890 [details] [review]
> Bug 43463: (QA follow-up) Regex should handle port with no tcp suffix
> 
> Previous regex could handle "127.0.0.1:8023/tcp/IPv4" but not
> "127.0.0.1:8023"
> 
> Signed-off-by: Kyle M Hall <[email protected]>

This got me thinking...

C4::SIP:SIPServer is a subclass of Net::Server which takes the "port" property
and calls port_info() on that... which runs Net::Server::Proto's parse_info()
over "port", which is quite a large function:

https://metacpan.org/module/Net::Server::Proto/source#L175

Although I think it essentially processes it using the following:

        $info = {};
        $info->{'unix_type'} = $1
                    if $port =~ s{ (?<=[\w*\]]) [,|\s:/]+
(sock_stream|sock_dgram) \b }{}x; # legacy /some/path|sock_dgram
        $ipv   = $1 if $port =~ s{ (?<=[\w*\]]) [,|\s:/]+ IPv([*\d]+) }{}xi; #
allow for 80|IPv*
        $ipv  .= $1 if $port =~ s{ (?<=[\w*\]]) [,|\s:/]+ IPv([*\d]+) }{}xi; #
allow for 80|IPv4|IPv6 stacked
        $proto = $1 if $port =~ s{ (?<=[\w*\]]) [,|\s:/]+
(tcp|udp|ssl|ssleay|unix|unixdgram|\w+(?: ::\w+)+) $ }{}xi # allow for 80/tcp
or 200/udp or 90/Net::Server::Proto::TCP
                    || $port =~ s{ / (\w+) $ }{}x; # legacy 80/MyTcp support
        $host  = $1 if $port =~ s{ ^ (.*?)      [,|\s:]+  (?= \w+ $) }{}x; #
allow localhost:80
        $info->{'port'} = $port;

I wonder if it would be worthwhile implementing the same algorithm.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to