]> git.proxmox.com Git - ceph.git/blob - ceph/src/civetweb/test/ajax/echo.lua
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / civetweb / test / ajax / echo.lua
1 resp = "{";
2
3 method = mg.request_info.request_method
4 uri = mg.request_info.uri
5 query = mg.request_info.query_string
6 datalen = nil -- TODO: "CONTENT_LENGTH" !
7
8 if method then
9 resp = resp .. '"method" : "' .. method .. '", ';
10 end
11 if uri then
12 resp = resp .. '"uri" : "' .. uri .. '", ';
13 end
14 if query then
15 resp = resp .. '"query" : "' .. query .. '", ';
16 end
17 if datalen then
18 resp = resp .. '"datalen" : "' .. datalen .. '", ';
19 end
20
21 resp = resp .. '"time" : "' .. os.date() .. '" ';
22
23 resp = resp .. "}";
24
25
26
27 mg.write("HTTP/1.1 200 OK\r\n")
28 mg.write("Connection: close\r\n")
29 mg.write("Content-Type: text/html\r\n")
30 mg.write("Cache-Control: no-cache\r\n")
31 --mg.write("Content-Length: " .. resp:len() .. "\n")
32 mg.write("\r\n")
33
34 mg.write(resp)
35