mirror of
https://github.com/openwrt/luci.git
synced 2026-08-29 08:31:46 +04:00
httpclient: fix parsing of IPv6 URLs (#662)
This commit is contained in:
@@ -108,11 +108,22 @@ end
|
||||
function request_raw(uri, options)
|
||||
options = options or {}
|
||||
local pr, auth, host, port, path
|
||||
if uri:find("@") then
|
||||
pr, auth, host, port, path =
|
||||
uri:match("(%w+)://(.+)@([%w-.]+):?([0-9]*)(.*)")
|
||||
|
||||
if uri:find("%[") then
|
||||
if uri:find("@") then
|
||||
pr, auth, host, port, path = uri:match("(%w+)://(.+)@(%b[]):?([0-9]*)(.*)")
|
||||
host = host:sub(2,-2)
|
||||
else
|
||||
pr, host, port, path = uri:match("(%w+)://(%b[]):?([0-9]*)(.*)")
|
||||
host = host:sub(2,-2)
|
||||
end
|
||||
else
|
||||
pr, host, port, path = uri:match("(%w+)://([%w-.]+):?([0-9]*)(.*)")
|
||||
if uri:find("@") then
|
||||
pr, auth, host, port, path =
|
||||
uri:match("(%w+)://(.+)@([%w-.]+):?([0-9]*)(.*)")
|
||||
else
|
||||
pr, host, port, path = uri:match("(%w+)://([%w-.]+):?([0-9]*)(.*)")
|
||||
end
|
||||
end
|
||||
|
||||
if not host then
|
||||
|
||||
Reference in New Issue
Block a user