Diff

net/http.lua @ 628:3712d36b6d25

Fixed URL encoding to generate %0x instead of %x
author Waqas Hussain <waqas20@gmail.com>
date Tue, 16 Dec 2008 03:46:17 +0500
parent 619:6d720aba51cb
child 633:fe1e01a06729
line wrap: on
line diff
--- a/net/http.lua	Sat Dec 13 17:43:52 2008 +0000
+++ b/net/http.lua	Tue Dec 16 03:46:17 2008 +0500
@@ -13,7 +13,7 @@
 local print = function () end
 
 local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = 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 urlencode = function (s) return s and (s:gsub("%W", function (c) return string.format("%%%02x", c:byte()); end)); end
 
 module "http"