diff options
author | Kim Alvefur <zash@zash.se> | 2018-09-21 23:40:17 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-09-21 23:40:17 +0200 |
commit | 91c5bd7853a6b40c87674399fce3a1f1f58e4754 (patch) | |
tree | c952960bbce005724dd5bfeece2bc396e76ffe56 /net/http/server.lua | |
parent | 823ff4025953375aecb550b6fffefaf2415ca3c6 (diff) | |
download | prosody-91c5bd7853a6b40c87674399fce3a1f1f58e4754.tar.gz prosody-91c5bd7853a6b40c87674399fce3a1f1f58e4754.zip |
net.http.server: Fire an event without host
Diffstat (limited to 'net/http/server.lua')
-rw-r--r-- | net/http/server.lua | 11 |
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; |