From b46533a889c624354136fb78211aa233f0aa460c Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 22 Apr 2009 20:31:45 +0100 Subject: net.httpserver: Fix potential nil access --- net/httpserver.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net') 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"); -- cgit v1.2.3