Comparison

net/http/server.lua @ 9335:2dc7490899ae

net.http.server: Move handling of hosts to mod_http Now an event like `GET /path` is fired at first, and mod\_http dispatches the old `GET host/path` events.
author Kim Alvefur <zash@zash.se>
date Fri, 21 Sep 2018 21:19:41 +0200
parent 8362:c7d6c2558a24
child 9337:5d6b252bc36f
comparison
equal deleted inserted replaced
9334:a86736e0163c 9335:2dc7490899ae
231 response.status_code = err_code; 231 response.status_code = err_code;
232 response:send(events.fire_event("http-error", { code = err_code, message = err, response = response })); 232 response:send(events.fire_event("http-error", { code = err_code, message = err, response = response }));
233 return; 233 return;
234 end 234 end
235 235
236 local event = request.method.." "..host..request.path:match("[^?]*"); 236 local event = request.method.." "..request.path:match("[^?]*");
237 local payload = { request = request, response = response }; 237 local payload = { request = request, response = response };
238 log("debug", "Firing event: %s", event); 238 log("debug", "Firing event: %s", event);
239 local result = events.fire_event(event, payload); 239 local result = events.fire_event(event, payload);
240 if result ~= nil then 240 if result ~= nil then
241 if result ~= true then 241 if result ~= true then