3 -- Every CGI script that returns any valid JSON object will work in the test.
4 -- In case you do not have not yet used CGI, you may want to use this script which is written in Lua.
5 -- You may download an interpreter from http://luabinaries.sourceforge.net/download.html, extract it
6 -- to some folder in your search path (the path of the webserver or /usr/bin on Linux), and add the
7 -- following lines to your .conf file.
8 -- cgi_interpreter c:\somewhere\lua5.1.exe
9 -- enable_keep_alive yes
13 method = os.getenv("REQUEST_METHOD")
14 uri = os.getenv("REQUEST_URI");
15 query = os.getenv("QUERY_STRING");
16 datalen = os.getenv("CONTENT_LENGTH");
19 resp = resp .. '"method" : "' .. method .. '", ';
22 resp = resp .. '"uri" : "' .. uri .. '", ';
25 resp = resp .. '"query" : "' .. query .. '", ';
28 resp = resp .. '"datalen" : "' .. datalen .. '", ';
31 resp = resp .. '"time" : "' .. os.date() .. '" ';
38 print "Status: 200 OK"
39 print "Connection: close"
40 --print "Connection: keep-alive"
41 print "Content-Type: text/html; charset=utf-8"
42 print "Cache-Control: no-cache"
43 --print ("Content-Length: " .. resp:len())
52 -- Store the POST data to a file
53 if (method == "POST") then
54 myFile = io.open("data" .. query:sub(4) .. ".txt", "wb");
56 myFile:write("\r\n\r\n")
58 datalen = tonumber(datalen)
59 myFile:write("<<< " .. datalen .. " bytes of data >>>\r\n")
61 data = io.stdin:read(datalen)
64 myFile:write("\r\n<<< end >>>\r\n")
66 myFile:write("<<< no data >>>\r\n")