From c0b06a77fb5449b40d1490ecf7a8bda7a0d82cd1 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Fri, 5 Jul 2013 17:26:39 +0200 Subject: [PATCH] Create base files in rest subdirectory. --- src/rest/request.lua | 21 +++++++++++++++++++++ src/rest/response.lua | 0 2 files changed, 21 insertions(+) create mode 100644 src/rest/request.lua create mode 100644 src/rest/response.lua diff --git a/src/rest/request.lua b/src/rest/request.lua new file mode 100644 index 0000000..0d78839 --- /dev/null +++ b/src/rest/request.lua @@ -0,0 +1,21 @@ +local M = {} + +local urlcode = require("util.urlcode") + +function M:new() + --parse os.getenv("QUERY_STRING") + --parse os.getenv("REPLY")? + --parse arg + + local qs = os.getenv("QUERY_STRING") + local urlargs = {} + urlcode.parsequery(qs, urlargs) + + --supplement urlargs with arguments from the command-line + for _, v in ipairs(arg) do + local split = v:find("=") + if split ~= nil then + urlargs[v:sub(1, split - 1)] = v:sub(split + 1) + end + end +end diff --git a/src/rest/response.lua b/src/rest/response.lua new file mode 100644 index 0000000..e69de29