]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | resp = "{";\r |
2 | \r | |
3 | method = mg.request_info.request_method\r | |
4 | uri = mg.request_info.uri\r | |
5 | query = mg.request_info.query_string\r | |
6 | datalen = nil -- TODO: "CONTENT_LENGTH" !\r | |
7 | \r | |
8 | if method then\r | |
9 | resp = resp .. '"method" : "' .. method .. '", ';\r | |
10 | end\r | |
11 | if uri then\r | |
12 | resp = resp .. '"uri" : "' .. uri .. '", ';\r | |
13 | end\r | |
14 | if query then\r | |
15 | resp = resp .. '"query" : "' .. query .. '", ';\r | |
16 | end\r | |
17 | if datalen then\r | |
18 | resp = resp .. '"datalen" : "' .. datalen .. '", ';\r | |
19 | end\r | |
20 | \r | |
21 | resp = resp .. '"time" : "' .. os.date() .. '" ';\r | |
22 | \r | |
23 | resp = resp .. "}";\r | |
24 | \r | |
25 | \r | |
26 | \r | |
27 | mg.write("HTTP/1.1 200 OK\r\n")\r | |
28 | mg.write("Connection: close\r\n")\r | |
29 | mg.write("Content-Type: text/html\r\n")\r | |
30 | mg.write("Cache-Control: no-cache\r\n")\r | |
31 | --mg.write("Content-Length: " .. resp:len() .. "\n")\r | |
32 | mg.write("\r\n")\r | |
33 | \r | |
34 | mg.write(resp)\r | |
35 | \r |