diff options
author | Kim Alvefur <zash@zash.se> | 2018-09-21 21:19:41 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-09-21 21:19:41 +0200 |
commit | 245cf9bfbfb09aee6238a6e50cd6bd8016661b30 (patch) | |
tree | 27666a6c80dca62134dbb3a1d9d574ba01809ff1 /plugins | |
parent | d68f852f3b28e48e56fd205fe31015fc3a591cc2 (diff) | |
download | prosody-245cf9bfbfb09aee6238a6e50cd6bd8016661b30.tar.gz prosody-245cf9bfbfb09aee6238a6e50cd6bd8016661b30.zip |
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.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_http.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 28d5d2d4..bd94de40 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -172,7 +172,13 @@ module:wrap_object_event(server._events, false, function (handlers, event_name, -- Not included in eg http-error events request.ip = get_ip_from_request(request); end - return handlers(event_name, event_data); + local ret = handlers(event_name, event_data); + if ret ~= nil then + return ret; + end + local host = (request.headers.host or ""):match("[^:]+"); + local host_event = request.method.." "..host..request.path:match("[^?]*"); + return handlers(host_event, event_data); end); module:provides("net", { |