aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-09-21 22:14:40 +0200
committerKim Alvefur <zash@zash.se>2018-09-21 22:14:40 +0200
commita31b6728d47b09b101f751db192cc9e781f34b66 (patch)
tree4a0a03ae857fc3a35b08e359714cb405ec8af405
parent83cd0e7ba79e37d9f078e8272adedba69dc3bb7f (diff)
downloadprosody-a31b6728d47b09b101f751db192cc9e781f34b66.tar.gz
prosody-a31b6728d47b09b101f751db192cc9e781f34b66.zip
Revert 2dc7490899ae::5d6b252bc36f: Unfinished and broken
-rw-r--r--net/http/server.lua4
-rw-r--r--plugins/mod_http.lua14
2 files changed, 4 insertions, 14 deletions
diff --git a/net/http/server.lua b/net/http/server.lua
index 2d9eed21..877c7f17 100644
--- a/net/http/server.lua
+++ b/net/http/server.lua
@@ -219,7 +219,7 @@ function handle_request(conn, request, finish_cb)
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 @@ function handle_request(conn, request, finish_cb)
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);
diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua
index 1f1b8a87..28d5d2d4 100644
--- a/plugins/mod_http.lua
+++ b/plugins/mod_http.lua
@@ -38,11 +38,7 @@ local function get_http_event(host, app_path, key)
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 @@ 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
- 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", {