Software /
code /
prosody
Changeset
9338:9beb767295d4
Revert 2dc7490899ae::5d6b252bc36f: Unfinished and broken
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 21 Sep 2018 22:14:40 +0200 |
parents | 9337:5d6b252bc36f |
children | 9339:a35a636481c6 |
files | net/http/server.lua plugins/mod_http.lua |
diffstat | 2 files changed, 4 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/net/http/server.lua Fri Sep 21 21:33:41 2018 +0200 +++ b/net/http/server.lua Fri Sep 21 22:14:40 2018 +0200 @@ -219,7 +219,7 @@ err_code, err = 400, "Invalid path"; elseif not hosts[host] then if hosts[default_host] then - request.host = default_host; + host = default_host; elseif host then err_code, err = 404, "Unknown host: "..host; else @@ -233,7 +233,7 @@ return; end - local event = request.method.." "..request.path:match("[^?]*"); + local 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);
--- a/plugins/mod_http.lua Fri Sep 21 21:33:41 2018 +0200 +++ b/plugins/mod_http.lua Fri Sep 21 22:14:40 2018 +0200 @@ -38,11 +38,7 @@ if app_path == "/" and path:sub(1,1) == "/" then app_path = ""; end - if host == "*" then - return method:upper().." "..app_path..path; - else - return method:upper().." "..host..app_path..path; - end + return method:upper().." "..host..app_path..path; end local function get_base_path(host_module, app_name, default_app_path) @@ -176,13 +172,7 @@ -- Not included in eg http-error events request.ip = get_ip_from_request(request); end - 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); + return handlers(event_name, event_data); end); module:provides("net", {