aboutsummaryrefslogtreecommitdiffstats
path: root/core/configmanager.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2014-07-31 07:14:54 +0100
committerMatthew Wild <mwild1@gmail.com>2014-07-31 07:14:54 +0100
commit1476fb77d161eca9a1e340fc546b82119e49699c (patch)
tree8f4e0289c3e75e44a5062bbb7bba8306789b91d6 /core/configmanager.lua
parent5c2035b30a344e8bc45ffe4c7329c603cd8e6cd3 (diff)
parent3b8d61bf9828b5aa1e4f1776b306aeea5dfe8bb7 (diff)
downloadprosody-1476fb77d161eca9a1e340fc546b82119e49699c.tar.gz
prosody-1476fb77d161eca9a1e340fc546b82119e49699c.zip
Merge 0.10->trunk
Diffstat (limited to 'core/configmanager.lua')
-rw-r--r--core/configmanager.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/configmanager.lua b/core/configmanager.lua
index 1f7342b2..48f039ea 100644
--- a/core/configmanager.lua
+++ b/core/configmanager.lua
@@ -19,6 +19,9 @@ local resolve_relative_path = require"util.paths".resolve_relative_path;
local glob_to_pattern = require"util.paths".glob_to_pattern;
local path_sep = package.config:sub(1,1);
+local have_encodings, encodings = pcall(require, "util.encodings");
+local nameprep = have_encodings and encodings.stringprep.nameprep or function (host) return host:lower(); end
+
module "configmanager"
_M.resolve_relative_path = resolve_relative_path; -- COMPAT
@@ -139,6 +142,7 @@ do
rawset(env, "__currenthost", "*") -- Default is global
function env.VirtualHost(name)
+ name = nameprep(name);
if rawget(config, name) and rawget(config[name], "component_module") then
error(format("Host %q clashes with previously defined %s Component %q, for services use a sub-domain like conference.%s",
name, config[name].component_module:gsub("^%a+$", { component = "external", muc = "MUC"}), name, name), 0);
@@ -156,6 +160,7 @@ do
env.Host, env.host = env.VirtualHost, env.VirtualHost;
function env.Component(name)
+ name = nameprep(name);
if rawget(config, name) and rawget(config[name], "defined") and not rawget(config[name], "component_module") then
error(format("Component %q clashes with previously defined Host %q, for services use a sub-domain like conference.%s",
name, name, name), 0);