comparison util/http.lua @ 13925:a4c47203a9eb

various: Do not mutate loop variables as they are treated as const in Lua 5.5 Loop variables are treated as <const> in Lua 5.5 and can't be modified without declaring another local. Ref https://github.com/lua/lua/commit/b2f7b3b79f3117885b265575f6c5dbf934757797
author Kim Alvefur <zash@zash.se>
date Fri, 23 Feb 2024 18:44:13 +0100
parents f15e23840780
children
comparison
equal deleted inserted replaced
13924:7fdf7645b0da 13925:a4c47203a9eb
43 end 43 end
44 44
45 local function formdecode(s) 45 local function formdecode(s)
46 if not s:match("=") then return urldecode(s); end 46 if not s:match("=") then return urldecode(s); end
47 local r = {}; 47 local r = {};
48 for k, v in s:gmatch("([^=&]*)=([^&]*)") do 48 for uk, uv in s:gmatch("([^=&]*)=([^&]*)") do
49 k, v = k:gsub("%+", "%%20"), v:gsub("%+", "%%20"); 49 local k, v = uk:gsub("%+", "%%20"), uv:gsub("%+", "%%20");
50 k, v = urldecode(k), urldecode(v); 50 k, v = urldecode(k), urldecode(v);
51 t_insert(r, { name = k, value = v }); 51 t_insert(r, { name = k, value = v });
52 r[k] = v; 52 r[k] = v;
53 end 53 end
54 return r; 54 return r;