mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-26 04:28:20 +01:00
fixed URL parsing in url.lua: parse fragment after parsing username and password.
This commit is contained in:
parent
5a17f79b03
commit
3ee89515a0
10
src/url.lua
10
src/url.lua
@ -131,11 +131,6 @@ function _M.parse(url, default)
|
||||
if not url or url == "" then return nil, "invalid url" end
|
||||
-- remove whitespace
|
||||
-- url = string.gsub(url, "%s", "")
|
||||
-- get fragment
|
||||
url = string.gsub(url, "#(.*)$", function(f)
|
||||
parsed.fragment = f
|
||||
return ""
|
||||
end)
|
||||
-- get scheme
|
||||
url = string.gsub(url, "^([%w][%w%+%-%.]*)%:",
|
||||
function(s) parsed.scheme = s; return "" end)
|
||||
@ -149,6 +144,11 @@ function _M.parse(url, default)
|
||||
parsed.query = q
|
||||
return ""
|
||||
end)
|
||||
-- get fragment
|
||||
url = string.gsub(url, "#(.*)$", function(f)
|
||||
parsed.fragment = f
|
||||
return ""
|
||||
end)
|
||||
-- get params
|
||||
url = string.gsub(url, "%;(.*)", function(p)
|
||||
parsed.params = p
|
||||
|
Loading…
Reference in New Issue
Block a user