summaryrefslogtreecommitdiffhomepage
path: root/src/ffluci/http.lua
diff options
context:
space:
mode:
Diffstat (limited to 'src/ffluci/http.lua')
-rw-r--r--src/ffluci/http.lua10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ffluci/http.lua b/src/ffluci/http.lua
index 81076233b9..b7ce92ffab 100644
--- a/src/ffluci/http.lua
+++ b/src/ffluci/http.lua
@@ -38,20 +38,24 @@ end
-- Asks the browser to redirect to "url"
-function redirect(url)
+function redirect(url, qs)
+ if qs then
+ url = url .. "?" .. qs
+ end
+
status(302, "Found")
print("Location: " .. url .. "\n")
end
-- Same as redirect but accepts category, module and action for internal use
-function request_redirect(category, module, action)
+function request_redirect(category, module, action, ...)
category = category or "public"
module = module or "index"
action = action or "index"
local pattern = os.getenv("SCRIPT_NAME") .. "/%s/%s/%s"
- redirect(pattern:format(category, module, action))
+ redirect(pattern:format(category, module, action), ...)
end