# HG changeset patch # User Matthew Wild # Date 1353618060 0 # Node ID a08b9448f277b62dba56a7b26099fb16cc0f2593 # Parent 7f6cc8ed22477f641f6d6cdbe12e777d45602b99# Parent 3fc3a3072cc2290ef97a38536f522d8c5310f595 Merge 0.9->trunk diff -r 7f6cc8ed2247 -r a08b9448f277 core/modulemanager.lua --- a/core/modulemanager.lua Thu Nov 22 19:38:42 2012 +0000 +++ b/core/modulemanager.lua Thu Nov 22 21:01:00 2012 +0000 @@ -111,7 +111,7 @@ return true; end -local function do_load_module(host, module_name) +local function do_load_module(host, module_name, state) if not (host and module_name) then return nil, "insufficient-parameters"; elseif not hosts[host] and host ~= "*"then @@ -152,7 +152,8 @@ local _log = logger.init(host..":"..module_name); local api_instance = setmetatable({ name = module_name, host = host, - _log = _log, log = function (self, ...) return _log(...); end, event_handlers = new_multitable() } + _log = _log, log = function (self, ...) return _log(...); end, event_handlers = new_multitable(), + reloading = not not state, saved_state = state~=true and state or nil } , { __index = api }); local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); @@ -176,6 +177,7 @@ log("warn", "Error loading module '%s' on '%s': %s", module_name, host, err or "nil"); end end + api_instance.reloading, api_instance.saved_state = nil, nil; if api_instance.host == "*" then if not api_instance.global then -- COMPAT w/pre-0.9 @@ -225,8 +227,9 @@ end end + mod.module.reloading = true; do_unload_module(host, name); - local ok, err = do_load_module(host, name); + local ok, err = do_load_module(host, name, saved or true); if ok then mod = get_module(host, name); if module_has_method(mod, "restore") then diff -r 7f6cc8ed2247 -r a08b9448f277 plugins/mod_http.lua --- a/plugins/mod_http.lua Thu Nov 22 19:38:42 2012 +0000 +++ b/plugins/mod_http.lua Thu Nov 22 21:01:00 2012 +0000 @@ -55,7 +55,7 @@ for port, services in pairs(ports) do local url = { scheme = (external_url.scheme or services[1].service.name); - host = (external_url.host or module.host); + host = (external_url.host or module:get_option_string("http_host", module.host)); port = tonumber(external_url.port) or port or 80; path = normalize_path(external_url.path or "/").. (get_base_path(module, app_name, default_path or "/"..app_name):sub(2));