13 tonumber, tostring, pairs, xpcall, select, debug.traceback; |
13 tonumber, tostring, pairs, xpcall, select, debug.traceback; |
14 |
14 |
15 local log = require "util.logger".init("http"); |
15 local log = require "util.logger".init("http"); |
16 local print = function () end |
16 local print = function () end |
17 |
17 |
18 local urlcodes = setmetatable({}, { __index = function (t, k) t[k] = char(tonumber("0x"..k)); return t[k]; end }); |
|
19 local urlencode = function (s) return s and (s:gsub("%W", function (c) return string.format("%%%02x", c:byte()); end)); end |
18 local urlencode = function (s) return s and (s:gsub("%W", function (c) return string.format("%%%02x", c:byte()); end)); end |
20 |
19 |
21 module "http" |
20 module "http" |
22 |
21 |
23 local function expectbody(reqt, code) |
22 local function expectbody(reqt, code) |