projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8806da0
)
net.http: Add request.id to every request object (can be overridden by providing...
author
Matthew Wild
<mwild1@gmail.com>
Thu, 7 Jul 2016 22:07:19 +0000
(23:07 +0100)
committer
Matthew Wild
<mwild1@gmail.com>
Thu, 7 Jul 2016 22:07:19 +0000
(23:07 +0100)
net/http.lua
patch
|
blob
|
history
diff --git
a/net/http.lua
b/net/http.lua
index b78f84382b40137484b3261ce541ded64c153d27..5fa0c0a947108e0337b78524aaac1f3a3dc8b418 100644
(file)
--- a/
net/http.lua
+++ b/
net/http.lua
@@
-27,6
+27,8
@@
local _ENV = nil;
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
@@
local function request(u, ex, callback)
req.path = "/";
end
+ req.id = ex and ex.id or make_id(req);
+
local method, headers, body;
local host, port = req.host, req.port;