aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-09-21 23:40:17 +0200
committerKim Alvefur <zash@zash.se>2018-09-21 23:40:17 +0200
commit10045809c982790285909b43e841c5c0413bcba2 (patch)
treec952960bbce005724dd5bfeece2bc396e76ffe56
parent2bc4476e8df60dc42c1e228fdbd8b4a6a365fd14 (diff)
downloadprosody-10045809c982790285909b43e841c5c0413bcba2.tar.gz
prosody-10045809c982790285909b43e841c5c0413bcba2.zip
net.http.server: Fire an event without host
-rw-r--r--net/http/server.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index 877c7f17..5b42208c 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -233,10 +233,15 @@ function handle_request(conn, request, finish_cb)
return;
end
- local event = request.method.." "..host..request.path:match("[^?]*");
+ local global_event = request.method.." "..request.path:match("[^?]*");
+ local host_event = request.method.." "..host..request.path:match("[^?]*");
local payload = { request = request, response = response };
- log("debug", "Firing event: %s", event);
- local result = events.fire_event(event, payload);
+ log("debug", "Firing event: %s", global_event);
+ local result = events.fire_event(global_event, payload);
+ if result == nil then
+ log("debug", "Firing event: %s", host_event);
+ result = events.fire_event(host_event, payload);
+ end
if result ~= nil then
if result ~= true then
local body;