Software /
code /
prosody
Diff
net/http.lua @ 7463:3b6e7ce9431f
net.http: Add request.id to every request object (can be overridden by providing ex.id)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 07 Jul 2016 23:07:19 +0100 |
parent | 6823:3b07f38d70f5 |
child | 7464:3b7de72e58a9 |
line wrap: on
line diff
--- 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;