# HG changeset patch # User Kim Alvefur # Date 1537560880 -7200 # Node ID 9beb767295d432fe4bc0e6d0791f79d5b2c30e65 # Parent 5d6b252bc36ff7df45799d4f60a9ff582e88c242 Revert 2dc7490899ae::5d6b252bc36f: Unfinished and broken diff -r 5d6b252bc36f -r 9beb767295d4 net/http/server.lua --- 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); diff -r 5d6b252bc36f -r 9beb767295d4 plugins/mod_http.lua --- 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", {