aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-06-22 16:16:08 +0100
committerMatthew Wild <mwild1@gmail.com>2009-06-22 16:16:08 +0100
commit3d891979efc61afdef96424fbb8a70b95d18cecf (patch)
tree0cace87163e93f5ff2c2e85af0e61e9fa159d5b4
parent23116a45d4daf902d68e77500a4e600509b2052d (diff)
downloadprosody-3d891979efc61afdef96424fbb8a70b95d18cecf.tar.gz
prosody-3d891979efc61afdef96424fbb8a70b95d18cecf.zip
mod_httpserver: Allow configuration of ports and base path, like mod_bosh
-rw-r--r--plugins/mod_httpserver.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/mod_httpserver.lua b/plugins/mod_httpserver.lua
index 2bcdab43..ec22a4bf 100644
--- a/plugins/mod_httpserver.lua
+++ b/plugins/mod_httpserver.lua
@@ -19,4 +19,15 @@ local function handle_request(method, body, request)
return data;
end
-httpserver.new{ port = 5280, base = "files", handler = handle_request, ssl = false} \ No newline at end of file
+local ports = config.get(module.host, "core", "http_ports") or { 5280 };
+for _, options in ipairs(ports) do
+ local port, base, ssl, interface = 5280, "files", false, nil;
+ if type(options) == "number" then
+ port = options;
+ elseif type(options) == "table" then
+ port, base, ssl, interface = options.port or 5280, options.path or "files", options.ssl or false, options.interface;
+ elseif type(options) == "string" then
+ base = options;
+ end
+ httpserver.new{ port = port, base = base, handler = handle_request, ssl = ssl }
+end