From 9f9a4c8e6c42bfa5b338c2a7d4c43c618f79e917 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 14 Mar 2015 22:39:23 +0000 Subject: mod_http: Log event name when adding a HTTP app's hooks --- plugins/mod_http.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'plugins/mod_http.lua') diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 86689aff..610ae0ae 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -102,6 +102,7 @@ function module.add_host(module) end if not app_handlers[event_name] then app_handlers[event_name] = handler; + module:log("debug", "Adding app '%s' to handle %s", app_name, event_name); module:hook_object_event(server, event_name, handler); else module:log("warn", "App %s added handler twice for '%s', ignoring", app_name, event_name); -- cgit v1.2.3 From 833a34dd6591bd37fc5d937df64db0462f160a72 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 23 Mar 2015 18:40:12 +0100 Subject: Backout 7726b627c3ea --- plugins/mod_http.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'plugins/mod_http.lua') diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 610ae0ae..86689aff 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -102,7 +102,6 @@ function module.add_host(module) end if not app_handlers[event_name] then app_handlers[event_name] = handler; - module:log("debug", "Adding app '%s' to handle %s", app_name, event_name); module:hook_object_event(server, event_name, handler); else module:log("warn", "App %s added handler twice for '%s', ignoring", app_name, event_name); -- cgit v1.2.3 From e1988edd2e558c25c5eb38439fbbc549fd151302 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 23 Mar 2015 18:44:12 +0100 Subject: mod_http: Log a debug message when adding new http apps and warn if no http ports are enabled --- plugins/mod_http.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'plugins/mod_http.lua') diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 86689aff..9ff3af74 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -110,6 +110,12 @@ function module.add_host(module) module:log("error", "Invalid route in %s, %q. See http://prosody.im/doc/developers/http#routes", app_name, key); end end + local services = portmanager.get_active_services(); + if services:get("https") or services:get("http") then + module:log("debug", "Serving '%s' at %s", app_name, module:http_url(app_name, app_path)); + else + module:log("warn", "Not listening on any ports, '%s' will be unreachable", app_name); + end end local function http_app_removed(event) -- cgit v1.2.3 From 54b9ab1ce4d82755e682dc5f842084812213be64 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 23 Mar 2015 18:45:02 +0100 Subject: mod_http: Return a static string from module:http_url() when no ports are enabled and log a warning --- plugins/mod_http.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins/mod_http.lua') diff --git a/plugins/mod_http.lua b/plugins/mod_http.lua index 9ff3af74..9b574bc8 100644 --- a/plugins/mod_http.lua +++ b/plugins/mod_http.lua @@ -69,6 +69,8 @@ function moduleapi.http_url(module, app_name, default_path) return url_build(url); end end + module:log("warn", "No http ports enabled, can't generate an external URL"); + return "http://disabled.invalid/"; end function module.add_host(module) -- cgit v1.2.3