Merge 0.9->0.10
authorKim Alvefur <zash@zash.se>
Wed, 26 Feb 2014 22:21:55 +0100
changeset 6027 8c69cea8a1bf
parent 6021 f8c17af769d9 (current diff)
parent 6026 8a8be471ec72 (diff)
child 6028 14c63b8c3e06
child 6031 8796aa94c4b5
Merge 0.9->0.10
plugins/mod_http.lua
tools/ejabberd2prosody.lua
--- a/plugins/mod_auth_anonymous.lua	Wed Feb 19 20:13:35 2014 +0100
+++ b/plugins/mod_auth_anonymous.lua	Wed Feb 26 22:21:55 2014 +0100
@@ -43,7 +43,7 @@
 end
 
 function provider.users()
-	return next, hosts[host].sessions, nil;
+	return next, hosts[module.host].sessions, nil;
 end
 
 -- datamanager callback to disable writes
--- a/plugins/mod_http.lua	Wed Feb 19 20:13:35 2014 +0100
+++ b/plugins/mod_http.lua	Wed Feb 26 22:21:55 2014 +0100
@@ -42,7 +42,7 @@
 	return (normalize_path(host_module:get_option("http_paths", {})[app_name] -- Host
 		or module:get_option("http_paths", {})[app_name] -- Global
 		or default_app_path)) -- Default
-		:gsub("%$(%w+)", { host = module.host });
+		:gsub("%$(%w+)", { host = host_module.host });
 end
 
 local ports_by_scheme = { http = 80, https = 443, };
@@ -51,6 +51,9 @@
 function moduleapi.http_url(module, app_name, default_path)
 	app_name = app_name or (module.name:gsub("^http_", ""));
 	local external_url = url_parse(module:get_option_string("http_external_url")) or {};
+	if external_url.scheme and external_url.port == nil then
+		external_url.port = ports_by_scheme[external_url.scheme];
+	end
 	local services = portmanager.get_active_services();
 	local http_services = services:get("https") or services:get("http") or {};
 	for interface, ports in pairs(http_services) do
--- a/tools/ejabberd2prosody.lua	Wed Feb 19 20:13:35 2014 +0100
+++ b/tools/ejabberd2prosody.lua	Wed Feb 26 22:21:55 2014 +0100
@@ -44,8 +44,10 @@
 		for _, a in ipairs(tuple[4]) do build_stanza(a, stanza); end
 		if up then stanza:up(); else return stanza end
 	elseif tuple[1] == "xmlcdata" then
-		assert(type(tuple[2]) == "string", "XML CDATA has unexpected type: "..type(tuple[2]));
-		stanza:text(tuple[2]);
+		if type(tuple[2]) ~= "table" then
+			assert(type(tuple[2]) == "string", "XML CDATA has unexpected type: "..type(tuple[2]));
+			stanza:text(tuple[2]);
+		end -- else it's [], i.e., the null value, used for the empty string
 	else
 		error("unknown element type: "..serialize(tuple));
 	end