Merge with 0.5
[prosody.git] / plugins / mod_httpserver.lua
index ec22a4bf9789a3c73164f13e5f0d89498d525f10..a863928148bf33407b80c0c7cd8f31638813a84e 100644 (file)
@@ -1,3 +1,11 @@
+-- Prosody IM
+-- Copyright (C) 2008-2009 Matthew Wild
+-- Copyright (C) 2008-2009 Waqas Hussain
+-- 
+-- This project is MIT/X11 licensed. Please see the
+-- COPYING file in the source package for more information.
+--
+
 
 local httpserver = require "net.httpserver";
 
@@ -20,14 +28,4 @@ local function handle_request(method, body, request)
 end
 
 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
+httpserver.new_from_config(ports, "files", handle_request);