Comparison

plugins/mod_http.lua @ 6026:8a8be471ec72

mod_http: Fix http_external_url setting without an explicit port
author Kim Alvefur <zash@zash.se>
date Wed, 26 Feb 2014 22:19:58 +0100
parent 6025:583e5c1365fe
child 6027:8c69cea8a1bf
child 6590:7726b627c3ea
comparison
equal deleted inserted replaced
6025:583e5c1365fe 6026:8a8be471ec72
49 49
50 -- Helper to deduce a module's external URL 50 -- Helper to deduce a module's external URL
51 function moduleapi.http_url(module, app_name, default_path) 51 function moduleapi.http_url(module, app_name, default_path)
52 app_name = app_name or (module.name:gsub("^http_", "")); 52 app_name = app_name or (module.name:gsub("^http_", ""));
53 local external_url = url_parse(module:get_option_string("http_external_url")) or {}; 53 local external_url = url_parse(module:get_option_string("http_external_url")) or {};
54 if external_url.scheme and external_url.port == nil then
55 external_url.port = ports_by_scheme[external_url.scheme];
56 end
54 local services = portmanager.get_active_services(); 57 local services = portmanager.get_active_services();
55 local http_services = services:get("https") or services:get("http") or {}; 58 local http_services = services:get("https") or services:get("http") or {};
56 for interface, ports in pairs(http_services) do 59 for interface, ports in pairs(http_services) do
57 for port, services in pairs(ports) do 60 for port, services in pairs(ports) do
58 local url = { 61 local url = {