Merge 0.9->0.10
authorMatthew Wild <mwild1@gmail.com>
Thu, 31 Jul 2014 06:11:54 +0000 (07:11 +0100)
committerMatthew Wild <mwild1@gmail.com>
Thu, 31 Jul 2014 06:11:54 +0000 (07:11 +0100)
1  2 
core/configmanager.lua
prosodyctl

index 1f7342b2e3f9b9efd7cdee394f55840a0c6ca8b3,c8aa7b9a08c107db23b5a637beb05585e33bb718..48f039eac8c3eea55ebe45c64efe23b10cdb93e7
@@@ -15,14 -15,13 +15,17 @@@ local fire_event = prosody and prosody.
  
  local envload = require"util.envload".envload;
  local deps = require"util.dependencies";
 +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
 +
  local parsers = {};
  
  local config_mt = { __index = function (t, k) return rawget(t, "*"); end};
                                        set(config, env.__currenthost or "*", k, v);
                                end
                });
 -              
 +
                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);
                        end;
                end
                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);
diff --cc prosodyctl
Simple merge