forked from manoelcampos/xml2lua
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcgitest.cgi
63 lines (49 loc) · 855 Bytes
/
cgitest.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/lua
dofile("cgi.lua")
dofile("xml.lua")
dofile("handler.lua")
dofile("pretty.lua")
c = CGI()
c.options.xml_parser = xmlParser
c.options.xml_handler = simpleTreeHandler
c:parse()
print [[Content-Type: text/plain
LUA CGI
=======
Env:
---
]]
for k,v in pairs(c.env) do
io.write(string.format("%-20s : %s\n",k,v))
end
print [[
Headers:
--------
]]
for k,v in pairs(c.headers) do
io.write(string.format("%-20s : %s\n",k,v))
end
print [[
Fields:
-------
]]
for k,v in pairs(c.fields) do
io.write(string.format("%-20s : %s\n",k,v))
end
print [[
Files:
-------
]]
for k,v in pairs(c.files) do
io.write(string.format("%-20s : %s\n","Name",k))
for k,v2 in pairs(v) do
if k ~= 'data' then
io.write(string.format("%-20s : %s\n",k,v2))
end
end
end
print [[
XML:
----
]]
pretty("XML", c.xml)