* Fixed haserl-lua Makefile
[project/luci.git] / src / ffluci / http.lua
index bf94105..b7ce92f 100644 (file)
@@ -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
 
 
@@ -59,7 +63,7 @@ end
 function formvalue(key, default)
        local c = formvalues()
        
-       for match in key:gmatch("%w+") do
+       for match in key:gmatch("[%w-_]+") do
                c = c[match]
                if c == nil then
                        return default