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 | ca374d38e725d53f33265bfb850a81b441d5e3b2 (patch) | |
tree | d914b19994f0aa3a0907c62cc8a85de98e30aea1 /net/httpserver.lua | |
parent | c8addd5dd0703701aa3eded7c040ffedd2840922 (diff) | |
download | prosody-ca374d38e725d53f33265bfb850a81b441d5e3b2.tar.gz prosody-ca374d38e725d53f33265bfb850a81b441d5e3b2.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 b16e7f3a..79cf33c2 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"); |