aboutsummaryrefslogtreecommitdiff
path: root/www/cgi-bin/cgi.lua
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2026-08-25 00:28:39 -0500
committericeyrazor <iceyrazor@mailfence.com>2026-08-25 00:28:39 -0500
commitd302872f3ab4ec1870e93037b012019566fc554c (patch)
tree4c355cc1c9e55a01535990822f6234b5b0198d20 /www/cgi-bin/cgi.lua
parent69c416c85bf92fca4b59aa78888a8aefbd0e0640 (diff)
reorginizationHEADmain
Diffstat (limited to 'www/cgi-bin/cgi.lua')
-rwxr-xr-xwww/cgi-bin/cgi.lua52
1 files changed, 0 insertions, 52 deletions
diff --git a/www/cgi-bin/cgi.lua b/www/cgi-bin/cgi.lua
deleted file mode 100755
index 5033984..0000000
--- a/www/cgi-bin/cgi.lua
+++ /dev/null
@@ -1,52 +0,0 @@
-local cgi={}
-
-cgi.newline=false
-
-function cgi.tag(key,value,attrib)
- local ret_str="<"..key
-
- if (attrib) then
- for a_key,a_val in pairs(attrib) do
- ret_str=ret_str.." "..a_key..'="'..a_val..'"'
- end
- end
-
- ret_str=ret_str..">"
- if cgi.newline==true then ret_str=ret_str.."\n" end
-
- ret_str=ret_str..value
-
- if cgi.newline==true then ret_str=ret_str.."\n" end
-
- ret_str=ret_str.."</"..key..">"
-
- if cgi.newline==true then ret_str=ret_str.."\n" end
-
- return ret_str
-end
-
-local function get_phrase(code)
- local cases={
- [200]="OK",
- [401]="Unauthorized",
- }
- if(cases[code]) then return cases[code] else return "" end
-end
-
-function cgi.header(code,headers)
- print("Status: "..code.." "..get_phrase(code))
- for h_name,header in pairs(headers) do
- print(h_name..": "..header)
- end
- print()
-end
-
-function cgi.render(content,headers,code)
- headers["Content-Length"] = tostring(content:len()+1)
- cgi.header(code,headers)
- print(content);
-end
-
-_G.m = cgi.tag
-
-return cgi