Merge 0.9->0.10 (third time lucky)
[prosody.git] / plugins / mod_http.lua
index 8bda1cac2ea5703536c6ad6b3d6acf1f4d8c7828..086887fbcc9a9b63ccd078c3a65804481d12a419 100644 (file)
@@ -74,6 +74,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)
@@ -118,6 +120,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)