mod_httpserver: Allow configuration of ports and base path, like mod_bosh

Mon, 22 Jun 2009 16:16:08 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 22 Jun 2009 16:16:08 +0100
changeset 1384
2f7403d47cf1
parent 1383
8774c5cbf147
child 1385
8999dd4253f9

mod_httpserver: Allow configuration of ports and base path, like mod_bosh

plugins/mod_httpserver.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_httpserver.lua	Mon Jun 22 14:22:24 2009 +0100
+++ b/plugins/mod_httpserver.lua	Mon Jun 22 16:16:08 2009 +0100
@@ -19,4 +19,15 @@
 	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

mercurial