Comparison

net/http.lua @ 11220:9b25eecde9e6

net.http: track time of request for debug/stats purposes
author Matthew Wild <mwild1@gmail.com>
date Wed, 09 Dec 2020 13:54:21 +0000
parent 11185:409ce7686c11
child 11661:735b8f4a6d7e
comparison
equal deleted inserted replaced
11219:586a6ed6b0a6 11220:9b25eecde9e6
22 22
23 local t_insert, t_concat = table.insert, table.concat; 23 local t_insert, t_concat = table.insert, table.concat;
24 local pairs = pairs; 24 local pairs = pairs;
25 local tonumber, tostring, traceback = 25 local tonumber, tostring, traceback =
26 tonumber, tostring, debug.traceback; 26 tonumber, tostring, debug.traceback;
27 local os_time = os.time;
27 local xpcall = require "util.xpcall".xpcall; 28 local xpcall = require "util.xpcall".xpcall;
28 local error = error 29 local error = error
29 30
30 local log = require "util.logger".init("http"); 31 local log = require "util.logger".init("http");
31 32
219 return nil, "invalid-url"; 220 return nil, "invalid-url";
220 end 221 end
221 222
222 req.url = u; 223 req.url = u;
223 req.http = self; 224 req.http = self;
225 req.time = os_time();
224 226
225 if not req.path then 227 if not req.path then
226 req.path = "/"; 228 req.path = "/";
227 end 229 end
228 230