(no commit message)
[project/luci.git] / core / src / ffluci / sgi / webuci.lua
index 75fffa55379f141395c28df0b150f5a54dad01f6..5e17ab7935607a092593e613f67669cd58166a16 100644 (file)
@@ -55,6 +55,10 @@ function ffluci.http.formvaluetable(prefix)
        return vals
 end
 
+-- Sends a custom HTTP-Header
+function ffluci.http.header(key, value)
+       print(key .. ": " .. value)
+end
 
 -- Set Content-Type
 function ffluci.http.prepare_content(type)
@@ -65,6 +69,13 @@ function ffluci.http.prepare_content(type)
        print("Content-Type: "..type.."\n")
 end
 
+-- Asks the browser to redirect to "url"
+function ffluci.http.redirect(url)
+       ffluci.http.status(302, "Found")
+       ffluci.http.header("Location", url)
+       print()
+end
+
 -- Sets HTTP-Status-Header
 function ffluci.http.status(code, message)
        print(webuci.env.SERVER_PROTOCOL .. " " .. tostring(code) .. " " .. message)