2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

HttpUtils.pm: Enable specifying IPv6 IP-Adress (Forum #75557)

git-svn-id: https://svn.fhem.de/fhem/trunk@15041 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2017-09-10 13:52:34 +00:00
parent 06ec12aa80
commit 4dade819c2

View File

@ -277,14 +277,19 @@ HttpUtils_Connect($)
Log3 $hash, $hash->{loglevel}, "HttpUtils url=$hash->{displayurl}";
if($hash->{url} !~
/^(http|https):\/\/(([^:\/]+):([^:\/]+)@)?([^:\/]+)(:\d+)?(\/.*)$/) {
if($hash->{url} !~ /
^(http|https):\/\/ # $1: proto
(([^:\/]+):([^:\/]+)@)? # $2: auth, $3:user, $4:password
([^:\/]+|\[[0-9a-f:]+\]) # $5: host or IPv6 address
(:\d+)? # $6: port
(\/.*)$ # $7: path
/xi) {
return "$hash->{displayurl}: malformed or unsupported URL";
}
my ($authstring,$user,$pwd,$port,$host);
($hash->{protocol},$authstring,$user,$pwd,$host,$port,$hash->{path})
= ($1,$2,$3,$4,$5,$6,$7);
= (lc($1),$2,$3,$4,$5,$6,$7);
$hash->{host} = $host;
if(defined($port)) {