Software /
code /
prosody
Comparison
plugins/mod_http.lua @ 4915:3fbc01d1fc5a
mod_http: Fix traceback when no HTTP services succeed in binding
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 26 May 2012 19:49:43 +0100 |
parent | 4911:4c8575b09ff6 |
child | 5092:a89f8f2f2943 |
comparison
equal
deleted
inserted
replaced
4914:2e9b16b2ae00 | 4915:3fbc01d1fc5a |
---|---|
42 -- Helper to deduce a module's external URL | 42 -- Helper to deduce a module's external URL |
43 function moduleapi.http_url(module, app_name, default_path) | 43 function moduleapi.http_url(module, app_name, default_path) |
44 app_name = app_name or (module.name:gsub("^http_", "")); | 44 app_name = app_name or (module.name:gsub("^http_", "")); |
45 local ext = url_parse(module:get_option_string("http_external_url")) or {}; | 45 local ext = url_parse(module:get_option_string("http_external_url")) or {}; |
46 local services = portmanager.get_active_services(); | 46 local services = portmanager.get_active_services(); |
47 local http_services = services:get("https") or services:get("http"); | 47 local http_services = services:get("https") or services:get("http") or {}; |
48 for interface, ports in pairs(http_services) do | 48 for interface, ports in pairs(http_services) do |
49 for port, services in pairs(ports) do | 49 for port, services in pairs(ports) do |
50 local path = get_base_path(module, app_name, default_path or "/"..app_name); | 50 local path = get_base_path(module, app_name, default_path or "/"..app_name); |
51 port = tonumber(ext.port) or port or 80; | 51 port = tonumber(ext.port) or port or 80; |
52 if port == 80 then port = ""; else port = ":"..port; end | 52 if port == 80 then port = ""; else port = ":"..port; end |