httpclient: fix parsing of IPv6 URLs (#662)
This commit is contained in:
parent
c1bd1e59d3
commit
b92a01d3ae
1 changed files with 15 additions and 4 deletions
|
@ -108,11 +108,22 @@ end
|
||||||
function request_raw(uri, options)
|
function request_raw(uri, options)
|
||||||
options = options or {}
|
options = options or {}
|
||||||
local pr, auth, host, port, path
|
local pr, auth, host, port, path
|
||||||
if uri:find("@") then
|
|
||||||
pr, auth, host, port, path =
|
if uri:find("%[") then
|
||||||
uri:match("(%w+)://(.+)@([%w-.]+):?([0-9]*)(.*)")
|
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
|
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
|
end
|
||||||
|
|
||||||
if not host then
|
if not host then
|
||||||
|
|
Loading…
Reference in a new issue