comparison net/httpserver.lua @ 4143:eccd3c87d717

net.httpserver: Log when an error occurs inside a HTTP request handler
author Matthew Wild <mwild1@gmail.com>
date Sun, 13 Feb 2011 22:57:17 +0000
parents ce3d100d9ebb
children c299726d2b4e
comparison
equal deleted inserted replaced
4136:19f2830fbe02 4143:eccd3c87d717
120 request.url.path = request.url.path and request.url.path:gsub("%%(%x%x)", function(x) return x.char(tonumber(x, 16)) end); 120 request.url.path = request.url.path and request.url.path:gsub("%%(%x%x)", function(x) return x.char(tonumber(x, 16)) end);
121 request.body = { request.body }; 121 request.body = { request.body };
122 call_callback(request); 122 call_callback(request);
123 end 123 end
124 local function error_cb(r) 124 local function error_cb(r)
125 log("error", "Error in HTTP server handler: %s", r or "connection-closed");
125 call_callback(request, r or "connection-closed"); 126 call_callback(request, r or "connection-closed");
126 destroy_request(request); 127 destroy_request(request);
127 end 128 end
128 request.parser = httpstream_new(success_cb, error_cb); 129 request.parser = httpstream_new(success_cb, error_cb);
129 end 130 end