From 7ddc5a142dae0b7536b06d0ee7a5d0b8653bc07a Mon Sep 17 00:00:00 2001 From: Annwan Date: Wed, 14 Aug 2024 15:39:22 +0200 Subject: [PATCH] Parsing boundaries in form data --- yqtemplate.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/yqtemplate.lua b/yqtemplate.lua index 6636e5f..018be51 100644 --- a/yqtemplate.lua +++ b/yqtemplate.lua @@ -8,8 +8,15 @@ local form = etlua.compile(yqtemplateform) return { desc = "Creates Yokoka’s quest-style personal status page", run = function(fcgi) - fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n") - local data = fcgi.post() - fcgi.print(form({data = data})) + fcgi.print("Content-Type: text/html; charset=utf-8\r\n\r\n") + local data = "" + if fcgi.getenv("REQUEST_METHOD") == "POST" then + --- @type string + local content_type = fcgi.getenv("CONTENT_TYPE") + local boundary = content_type:match("; boundary=(.*)$") + -- local post_data = fcgi.post() + data = "Content type:" .. content_type .. "\n Boundary: "..boundary.."\n" + end + fcgi.print(form{data = data}) end }