summaryrefslogtreecommitdiffhomepage
path: root/libs/luci-lib-httpclient/luasrc/httpclient.lua
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-12-09 17:36:05 +0100
committerJo-Philipp Wich <jo@mein.io>2019-12-09 17:36:05 +0100
commitd87169c0f60f9e7c1f8a61b2809473802093ff31 (patch)
treefef7e1aea5448d72e67ad2c66c83bc34e1a99425 /libs/luci-lib-httpclient/luasrc/httpclient.lua
parentf7a7f89e0ce324115098f4496e3e72d8bb63613a (diff)
luci-lib-httpclient: accept scoped IPv6 addresses
Ref: https://github.com/openwrt/luci/issues/3380 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'libs/luci-lib-httpclient/luasrc/httpclient.lua')
-rw-r--r--libs/luci-lib-httpclient/luasrc/httpclient.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/libs/luci-lib-httpclient/luasrc/httpclient.lua b/libs/luci-lib-httpclient/luasrc/httpclient.lua
index 79ce41294c..e9ec3ac29b 100644
--- a/libs/luci-lib-httpclient/luasrc/httpclient.lua
+++ b/libs/luci-lib-httpclient/luasrc/httpclient.lua
@@ -105,10 +105,10 @@ function parse_url(uri)
rest = tmp
end
- url.host, tmp = rest:match("^%[([0-9a-fA-F:]+)%](.*)$")
+ url.host, tmp = rest:match("^%[(.+)%](.*)$")
if url.host and tmp then
url.ip6addr = ip.IPv6(url.host)
- if not url.ip6addr then
+ if not url.ip6addr or url.ip6addr:prefix() < 128 then
return nil
end
url.host = string.format("[%s]", url.ip6addr:string())