Mercurial > prosody-hg
comparison plugins/mod_httpserver.lua @ 1384:2f7403d47cf1
mod_httpserver: Allow configuration of ports and base path, like mod_bosh
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 22 Jun 2009 16:16:08 +0100 |
| parents | b35faad717f2 |
| children | 569d58d21612 |
comparison
equal
deleted
inserted
replaced
| 1383:8774c5cbf147 | 1384:2f7403d47cf1 |
|---|---|
| 17 local data = f:read("*a"); | 17 local data = f:read("*a"); |
| 18 f:close(); | 18 f:close(); |
| 19 return data; | 19 return data; |
| 20 end | 20 end |
| 21 | 21 |
| 22 httpserver.new{ port = 5280, base = "files", handler = handle_request, ssl = false} | 22 local ports = config.get(module.host, "core", "http_ports") or { 5280 }; |
| 23 for _, options in ipairs(ports) do | |
| 24 local port, base, ssl, interface = 5280, "files", false, nil; | |
| 25 if type(options) == "number" then | |
| 26 port = options; | |
| 27 elseif type(options) == "table" then | |
| 28 port, base, ssl, interface = options.port or 5280, options.path or "files", options.ssl or false, options.interface; | |
| 29 elseif type(options) == "string" then | |
| 30 base = options; | |
| 31 end | |
| 32 httpserver.new{ port = port, base = base, handler = handle_request, ssl = ssl } | |
| 33 end |
