|
@ -10,18 +10,25 @@ return { |
|
|
run = function(fcgi) |
|
|
run = function(fcgi) |
|
|
fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n") |
|
|
fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n") |
|
|
local data = "" |
|
|
local data = "" |
|
|
--[[if fcgi.getenv("REQUEST_METHOD") == "POST" then |
|
|
|
|
|
|
|
|
if fcgi.getenv("REQUEST_METHOD") == "POST" then |
|
|
local content_type = fcgi.getenv("CONTENT_TYPE") |
|
|
local content_type = fcgi.getenv("CONTENT_TYPE") |
|
|
local boundary = content_type:match("; boundary=(.*)$") |
|
|
local boundary = content_type:match("; boundary=(.*)$") |
|
|
local post_data = fcgi.post() |
|
|
local post_data = fcgi.post() |
|
|
data = "Content type:" .. content_type .. "\n Boundary: " .. boundary .. "\n" |
|
|
data = "Content type:" .. content_type .. "\n Boundary: " .. boundary .. "\n" |
|
|
local args = {} |
|
|
local args = {} |
|
|
for w in string.gmatch(post_data, "(.-)" .. boundary) do |
|
|
for w in string.gmatch(post_data, "(.-)" .. boundary) do |
|
|
local dataheaders, _ = utils.parse_form_entry(w) |
|
|
|
|
|
args[#args + 1] = dataheaders |
|
|
|
|
|
|
|
|
local name, dtype, value = utils.parse_form_entry(w) |
|
|
|
|
|
args[name] = { t = dtype, v = value } |
|
|
end |
|
|
end |
|
|
data = table.concat(args, "\n\n") |
|
|
|
|
|
end ]] |
|
|
|
|
|
|
|
|
for k, v in pairs(args) do |
|
|
|
|
|
data = data .. k .. ": " |
|
|
|
|
|
if v.t then |
|
|
|
|
|
data = data .. "[FILE:" .. v.t .. "]\n" |
|
|
|
|
|
else |
|
|
|
|
|
data = data .. v.v .. "\n" |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
fcgi.print( |
|
|
fcgi.print( |
|
|
form { |
|
|
form { |
|
|
data = data, |
|
|
data = data, |
|
|