diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-04-22 20:31:45 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-04-22 20:31:45 +0100 |
commit | b46533a889c624354136fb78211aa233f0aa460c (patch) | |
tree | 825bfcf1362103e364d2e26ba12a95f48d745b85 /net/httpserver.lua | |
parent | 42d08e3e931fd5bb2906ed4cc22c4185906addce (diff) | |
download | prosody-b46533a889c624354136fb78211aa233f0aa460c.tar.gz prosody-b46533a889c624354136fb78211aa233f0aa460c.zip |
net.httpserver: Fix potential nil access
Diffstat (limited to 'net/httpserver.lua')
-rw-r--r-- | net/httpserver.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/httpserver.lua b/net/httpserver.lua index 906ffaf7..0ecf84ea 100644 --- a/net/httpserver.lua +++ b/net/httpserver.lua @@ -8,10 +8,10 @@ local connlisteners_get = require "net.connlisteners".get; local listener; local t_insert, t_concat = table.insert, table.concat; -local s_match, s_gmatch = string.match, string.gmatch; +local s_match, s_gmatch, s_char = string.match, string.gmatch; local tonumber, tostring, pairs = tonumber, tostring, pairs; -local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = char(tonumber("0x"..k)); return t[k]; end }); +local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = s_char(tonumber("0x"..k)); return t[k]; end }); local urlencode = function (s) return s and (s:gsub("%W", function (c) return string.format("%%%x", c:byte()); end)); end local log = require "util.logger".init("httpserver"); |