# HG changeset patch # User Matthew Wild # Date 1467929239 -3600 # Node ID 3b6e7ce9431fc42098c80abc849c9d109bc03017 # Parent 72e48bddf6179830f5ef1695ef703e2fdc2c9d87 net.http: Add request.id to every request object (can be overridden by providing ex.id) diff -r 72e48bddf617 -r 3b6e7ce9431f net/http.lua --- a/net/http.lua Tue Jun 28 14:49:44 2016 +0100 +++ b/net/http.lua Thu Jul 07 23:07:19 2016 +0100 @@ -27,6 +27,8 @@ local requests = {}; -- Open requests +local function make_id(req) return (tostring(req):match("%x+$")); end + local listener = { default_port = 80, default_mode = "*a" }; function listener.onconnect(conn) @@ -125,6 +127,8 @@ req.path = "/"; end + req.id = ex and ex.id or make_id(req); + local method, headers, body; local host, port = req.host, req.port;