Comparison

net/http/server.lua @ 13103:42c2a9787242

net.http.server: Remove "Firing event" logs, use event logging instead Since these are noisy and we have the thing in util.helpers to log events fired. The new status line events are meant to replace these as they include more useful info.
author Kim Alvefur <zash@zash.se>
date Sun, 14 May 2023 18:48:20 +0200
parent 13102:4e112b87543d
child 13118:6b5e92949051
comparison
equal deleted inserted replaced
13102:4e112b87543d 13103:42c2a9787242
287 end 287 end
288 288
289 local global_event = request.method.." "..request.path:match("[^?]*"); 289 local global_event = request.method.." "..request.path:match("[^?]*");
290 290
291 local payload = { request = request, response = response }; 291 local payload = { request = request, response = response };
292 request.log("debug", "Firing event: %s", global_event);
293 local result = events.fire_event(global_event, payload); 292 local result = events.fire_event(global_event, payload);
294 if result == nil and is_head_request then 293 if result == nil and is_head_request then
295 local global_head_event = "GET "..request.path:match("[^?]*"); 294 local global_head_event = "GET "..request.path:match("[^?]*");
296 request.log("debug", "Firing event: %s", global_head_event);
297 result = events.fire_event(global_head_event, payload); 295 result = events.fire_event(global_head_event, payload);
298 end 296 end
299 if result == nil then 297 if result == nil then
300 if not hosts[host] then 298 if not hosts[host] then
301 if hosts[default_host] then 299 if hosts[default_host] then
312 response:send(events.fire_event("http-error", { code = err_code, message = err, response = response })); 310 response:send(events.fire_event("http-error", { code = err_code, message = err, response = response }));
313 return; 311 return;
314 end 312 end
315 313
316 local host_event = request.method.." "..host..request.path:match("[^?]*"); 314 local host_event = request.method.." "..host..request.path:match("[^?]*");
317 request.log("debug", "Firing event: %s", host_event);
318 result = events.fire_event(host_event, payload); 315 result = events.fire_event(host_event, payload);
319 316
320 if result == nil and is_head_request then 317 if result == nil and is_head_request then
321 local host_head_event = "GET "..host..request.path:match("[^?]*"); 318 local host_head_event = "GET "..host..request.path:match("[^?]*");
322 request.log("debug", "Firing event: %s", host_head_event);
323 result = events.fire_event(host_head_event, payload); 319 result = events.fire_event(host_head_event, payload);
324 end 320 end
325 end 321 end
326 322
327 return handle_result(request, response, result); 323 return handle_result(request, response, result);