mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
bugfix, parsing http array form (#1852)
This commit is contained in:
@@ -20,7 +20,17 @@ end
|
||||
function url.parse_query(q)
|
||||
local r = {}
|
||||
for k,v in q:gmatch "(.-)=([^&]*)&?" do
|
||||
r[decode(k)] = decode(v)
|
||||
local dk, dv = decode(k), decode(v)
|
||||
local oldv = r[dk]
|
||||
if oldv then
|
||||
if type(oldv) ~= "table" then
|
||||
r[dk] = {oldv, dv}
|
||||
else
|
||||
oldv[#oldv+1] = dv
|
||||
end
|
||||
else
|
||||
r[dk] = dv
|
||||
end
|
||||
end
|
||||
return r
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user