aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-04-22 20:31:45 +0100
committerMatthew Wild <mwild1@gmail.com>2009-04-22 20:31:45 +0100
commitca374d38e725d53f33265bfb850a81b441d5e3b2 (patch)
treed914b19994f0aa3a0907c62cc8a85de98e30aea1 /net
parentc8addd5dd0703701aa3eded7c040ffedd2840922 (diff)
downloadprosody-ca374d38e725d53f33265bfb850a81b441d5e3b2.tar.gz
prosody-ca374d38e725d53f33265bfb850a81b441d5e3b2.zip
net.httpserver: Fix potential nil access
Diffstat (limited to 'net')
-rw-r--r--net/httpserver.lua4
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");