X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fluci-lib-httpclient%2Fluasrc%2Fhttpclient.lua;fp=libs%2Fluci-lib-httpclient%2Fluasrc%2Fhttpclient.lua;h=79ce41294c6074872142d2bcb8cba8bf7f542d5c;hp=f19fa44387e0544540aef10f728a12eea8195a42;hb=a692ca789ae916b1393a39236ff8cf3e8a431717;hpb=a54baf7be0d293b50c6b2754c11d61e6e2ad82af diff --git a/libs/luci-lib-httpclient/luasrc/httpclient.lua b/libs/luci-lib-httpclient/luasrc/httpclient.lua index f19fa44387..79ce41294c 100644 --- a/libs/luci-lib-httpclient/luasrc/httpclient.lua +++ b/libs/luci-lib-httpclient/luasrc/httpclient.lua @@ -108,20 +108,20 @@ function parse_url(uri) url.host, tmp = rest:match("^%[([0-9a-fA-F:]+)%](.*)$") if url.host and tmp then url.ip6addr = ip.IPv6(url.host) - url.host = string.format("[%s]", url.ip6addr:string()) - rest = tmp if not url.ip6addr then return nil end + url.host = string.format("[%s]", url.ip6addr:string()) + rest = tmp else url.host, tmp = rest:match("^(%d+%.%d+%.%d+%.%d+)(.*)$") if url.host and tmp then url.ipaddr = ip.IPv4(url.host) - url.host = url.ipaddr:string() - rest = tmp if not url.ipaddr then return nil end + url.host = url.ipaddr:string() + rest = tmp else url.host, tmp = rest:match("^([0-9a-zA-Z%.%-]+)(.*)$") if url.host and tmp then