equal
deleted
inserted
replaced
24 local log = require "util.logger".init("http"); |
24 local log = require "util.logger".init("http"); |
25 |
25 |
26 local _ENV = nil; |
26 local _ENV = nil; |
27 |
27 |
28 local requests = {}; -- Open requests |
28 local requests = {}; -- Open requests |
|
29 |
|
30 local function make_id(req) return (tostring(req):match("%x+$")); end |
29 |
31 |
30 local listener = { default_port = 80, default_mode = "*a" }; |
32 local listener = { default_port = 80, default_mode = "*a" }; |
31 |
33 |
32 function listener.onconnect(conn) |
34 function listener.onconnect(conn) |
33 local req = requests[conn]; |
35 local req = requests[conn]; |
122 end |
124 end |
123 |
125 |
124 if not req.path then |
126 if not req.path then |
125 req.path = "/"; |
127 req.path = "/"; |
126 end |
128 end |
|
129 |
|
130 req.id = ex and ex.id or make_id(req); |
127 |
131 |
128 local method, headers, body; |
132 local method, headers, body; |
129 |
133 |
130 local host, port = req.host, req.port; |
134 local host, port = req.host, req.port; |
131 local host_header = host; |
135 local host_header = host; |