Comparison

net/httpserver.lua @ 1053:c04b40a0740b

net.httpserver: Fix traceback when sending response to a destroyed request
author Matthew Wild <mwild1@gmail.com>
date Thu, 23 Apr 2009 21:04:56 +0100
parent 1052:a3429542631d
child 1054:084d265b37cf
child 1110:ececc4162d58
comparison
equal deleted inserted replaced
1052:a3429542631d 1053:c04b40a0740b
97 local response = callback(request.method, request.body and t_concat(request.body), request); 97 local response = callback(request.method, request.body and t_concat(request.body), request);
98 if response then 98 if response then
99 if response == true and not request.destroyed then 99 if response == true and not request.destroyed then
100 -- Keep connection open, we will reply later 100 -- Keep connection open, we will reply later
101 log("warn", "Request %s left open, on_destroy is %s", request.id, tostring(request.on_destroy)); 101 log("warn", "Request %s left open, on_destroy is %s", request.id, tostring(request.on_destroy));
102 else 102 elseif response ~= true then
103 -- Assume response 103 -- Assume response
104 send_response(request, response); 104 send_response(request, response);
105 destroy_request(request); 105 destroy_request(request);
106 end 106 end
107 else 107 else