Comparison

util/http.lua @ 9785:ff88b03c343f

util.http: Fix decoding of uppercase URL encoded chars Broken in 1af5106a2c34
author Kim Alvefur <zash@zash.se>
date Wed, 16 Jan 2019 13:53:04 +0100
parent 9759:1af5106a2c34
child 13124:f15e23840780
comparison
equal deleted inserted replaced
9784:7fa273f8869e 9785:ff88b03c343f
13 for i = 0, 255 do 13 for i = 0, 255 do
14 local c = char(i); 14 local c = char(i);
15 local u = format("%%%02x", i); 15 local u = format("%%%02x", i);
16 url_codes[c] = u; 16 url_codes[c] = u;
17 url_codes[u] = c; 17 url_codes[u] = c;
18 url_codes[u:upper()] = c;
18 end 19 end
19 local function urlencode(s) 20 local function urlencode(s)
20 return s and (s:gsub("[^a-zA-Z0-9.~_-]", url_codes)); 21 return s and (s:gsub("[^a-zA-Z0-9.~_-]", url_codes));
21 end 22 end
22 local function urldecode(s) 23 local function urldecode(s)