Comparison

net/httpserver.lua @ 4069:a90bbca91c87

net.httpserver: Decode percent-encoded characters in URL path.
author Waqas Hussain <waqas20@gmail.com>
date Wed, 05 Jan 2011 06:23:17 +0500
parent 3877:632f7038a67a
child 4005:420e57319f89
comparison
equal deleted inserted replaced
4068:15c4cefb825c 4069:a90bbca91c87
117 local function request_reader(request, data, startpos) 117 local function request_reader(request, data, startpos)
118 if not request.parser then 118 if not request.parser then
119 local function success_cb(r) 119 local function success_cb(r)
120 for k,v in pairs(r) do request[k] = v; end 120 for k,v in pairs(r) do request[k] = v; end
121 request.url = url_parse(request.path); 121 request.url = url_parse(request.path);
122 request.url.path = request.url.path and request.url.path:gsub("%%(%x%x)", function(x) return x.char(tonumber(x, 16)) end);
122 request.body = { request.body }; 123 request.body = { request.body };
123 call_callback(request); 124 call_callback(request);
124 end 125 end
125 local function error_cb(r) 126 local function error_cb(r)
126 call_callback(request, r or "connection-closed"); 127 call_callback(request, r or "connection-closed");