diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-12-16 02:03:35 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-12-16 02:03:35 +0000 |
commit | 6596347f05fe58a82f8c4ddcb78b3ca916397e83 (patch) | |
tree | be0cb3a00e84f22791275e00ad125bb149213fd4 | |
parent | bf88cc6f6c98c8d93bd5852194c0e4c14d0533a5 (diff) | |
download | prosody-6596347f05fe58a82f8c4ddcb78b3ca916397e83.tar.gz prosody-6596347f05fe58a82f8c4ddcb78b3ca916397e83.zip |
util.jid: Strip trailing '.' when normalizing hostnames
-rw-r--r-- | util/jid.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/util/jid.lua b/util/jid.lua index 4c4371d8..8e0a784c 100644 --- a/util/jid.lua +++ b/util/jid.lua @@ -8,7 +8,7 @@ -local match = string.match; +local match, sub = string.match, string.sub; local nodeprep = require "util.encodings".stringprep.nodeprep; local nameprep = require "util.encodings".stringprep.nameprep; local resourceprep = require "util.encodings".stringprep.resourceprep; @@ -47,6 +47,9 @@ end local function _prepped_split(jid) local node, host, resource = _split(jid); if host then + if sub(host, -1, -1) == "." then -- Strip empty root label + host = sub(host, 1, -2); + end host = nameprep(host); if not host then return; end if node then |