23 local ip = request.conn:ip(); |
23 local ip = request.conn:ip(); |
24 local req = string.format("%s %s HTTP/%s", request.method, request.path, request.httpversion); |
24 local req = string.format("%s %s HTTP/%s", request.method, request.path, request.httpversion); |
25 local date = os.date("%d/%m/%Y:%H:%M:%S %z"); |
25 local date = os.date("%d/%m/%Y:%H:%M:%S %z"); |
26 module:log("info", "%s - - [%s] \"%s\" %d %s", ip, date, req, response.status_code, tostring(len)); |
26 module:log("info", "%s - - [%s] \"%s\" %d %s", ip, date, req, response.status_code, tostring(len)); |
27 end |
27 end |
28 return server.send_response(response, body); |
28 return send_response(response, body); |
29 end |
29 end |
30 |
30 |
31 if module.wrap_object_event then |
31 if module.wrap_object_event then |
32 -- Use object event wrapping, allows clean unloading of the module |
32 -- Use object event wrapping, allows clean unloading of the module |
33 module:wrap_object_event(server._events, false, function (handlers, event_name, event_data) |
33 module:wrap_object_event(server._events, false, function (handlers, event_name, event_data) |