From d87169c0f60f9e7c1f8a61b2809473802093ff31 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 9 Dec 2019 17:36:05 +0100 Subject: luci-lib-httpclient: accept scoped IPv6 addresses Ref: https://github.com/openwrt/luci/issues/3380 Signed-off-by: Jo-Philipp Wich --- libs/luci-lib-httpclient/luasrc/httpclient.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libs/luci-lib-httpclient') diff --git a/libs/luci-lib-httpclient/luasrc/httpclient.lua b/libs/luci-lib-httpclient/luasrc/httpclient.lua index 79ce41294..e9ec3ac29 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()) -- cgit v1.2.3