mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-22 08:11:44 +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:
parent
06ec12aa80
commit
4dade819c2
@ -277,14 +277,19 @@ HttpUtils_Connect($)
|
|||||||
|
|
||||||
Log3 $hash, $hash->{loglevel}, "HttpUtils url=$hash->{displayurl}";
|
Log3 $hash, $hash->{loglevel}, "HttpUtils url=$hash->{displayurl}";
|
||||||
|
|
||||||
if($hash->{url} !~
|
if($hash->{url} !~ /
|
||||||
/^(http|https):\/\/(([^:\/]+):([^:\/]+)@)?([^:\/]+)(:\d+)?(\/.*)$/) {
|
^(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";
|
return "$hash->{displayurl}: malformed or unsupported URL";
|
||||||
}
|
}
|
||||||
|
|
||||||
my ($authstring,$user,$pwd,$port,$host);
|
my ($authstring,$user,$pwd,$port,$host);
|
||||||
($hash->{protocol},$authstring,$user,$pwd,$host,$port,$hash->{path})
|
($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;
|
$hash->{host} = $host;
|
||||||
|
|
||||||
if(defined($port)) {
|
if(defined($port)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user