Mercurial > prosody-hg
comparison plugins/mod_httpserver.lua @ 1538:dff620405503
mod_httpserver: Use new httpserver helper to initialise ports
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 12 Jul 2009 15:22:37 +0100 |
| parents | 569d58d21612 |
| children | 334b66f614a6 |
comparison
equal
deleted
inserted
replaced
| 1537:6670af04aeb6 | 1538:dff620405503 |
|---|---|
| 26 f:close(); | 26 f:close(); |
| 27 return data; | 27 return data; |
| 28 end | 28 end |
| 29 | 29 |
| 30 local ports = config.get(module.host, "core", "http_ports") or { 5280 }; | 30 local ports = config.get(module.host, "core", "http_ports") or { 5280 }; |
| 31 for _, options in ipairs(ports) do | 31 httpserver.new_from_config(ports, handle_request); |
| 32 local port, base, ssl, interface = 5280, "files", false, nil; | |
| 33 if type(options) == "number" then | |
| 34 port = options; | |
| 35 elseif type(options) == "table" then | |
| 36 port, base, ssl, interface = options.port or 5280, options.path or "files", options.ssl or false, options.interface; | |
| 37 elseif type(options) == "string" then | |
| 38 base = options; | |
| 39 end | |
| 40 httpserver.new{ port = port, base = base, handler = handle_request, ssl = ssl } | |
| 41 end |
