Software /
code /
prosody
Changeset
1038:90f663769b75
net.httpserver: Fix potential nil access
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Wed, 22 Apr 2009 20:31:45 +0100 |
parents | 1037:cb5fdce8dcec |
children | 1039:cc4280f45d0e |
files | net/httpserver.lua |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/net/httpserver.lua Wed Apr 22 20:29:35 2009 +0100 +++ b/net/httpserver.lua Wed Apr 22 20:31:45 2009 +0100 @@ -8,10 +8,10 @@ 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");