From d71b079932f2333b5f44b0730a351bd081b10d5b Mon Sep 17 00:00:00 2001 From: Marcos Kirsch Date: Mon, 15 Feb 2016 22:54:19 -0600 Subject: [PATCH] clean up, but example does not work at this time --- http/post.lua | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/http/post.lua b/http/post.lua index d1ac03d..2acae1b 100644 --- a/http/post.lua +++ b/http/post.lua @@ -1,33 +1,29 @@ return function (connection, req, args) - connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nCache-Control: private, no-store\r\n\r\n") - connection:send('Arguments') - connection:send('') - connection:send('

Arguments

') + dofile("httpserver-header.lc")(connection, 200, 'html') + connection:send([===[ + Arguments by POST

Arguments by POST

+ ]===]) - local form = [===[ -
- First name:

- Last name:

- MaleFemale
- -
- ]===] - if req.method == "GET" then - connection:send(form) + connection:send([===[ +
+ First name:

+ Last name:

+ MaleFemale
+ +
+ ]===]) elseif req.method == "POST" then - local rd = req.getRequestData() - -- connection:send(cjson.encode(rd)) + local rd = req.getRequestData() connection:send('

Received the following values:

') connection:send("\n") else - connection:send("NOT IMPLEMENTED") + connection:send("ERROR WTF req.method is ", req.method) end - + connection:send('') end