(no commit message)
[project/luci.git] / core / src / ffluci / sgi / haserl.lua
index 76dc3854aff52bee67ae15632c3ca0b17394f556..7e9854d7d38505868a93b92bfa675488a520eb13 100644 (file)
@@ -25,10 +25,9 @@ limitations under the License.
 ]]--
 module("ffluci.sgi.haserl", package.seeall)
 
-ENV = ENV or {}
-FORM = FORM or {}
+-- Environment Table
+ffluci.http.env = ENV
 
--- HTTP interface
 
 -- Returns a table of all COOKIE, GET and POST Parameters
 function ffluci.http.formvalues()
@@ -54,35 +53,24 @@ function ffluci.http.formvaluetable(prefix)
        return ffluci.http.formvalue(prefix, {})
 end
 
-
--- Returns the User's IP
-function ffluci.http.get_remote_addr()
-       return ENV.REMOTE_ADDR
+-- Sends a custom HTTP-Header
+function ffluci.http.header(key, value)
+       print(key .. ": " .. value)
 end
 
--- Returns the script name
-function ffluci.http.get_script_name()
-       return ENV.SCRIPT_NAME
+-- Set Content-Type
+function ffluci.http.prepare_content(type)
+       print("Content-Type: "..type.."\n")
 end
 
-
 -- Asks the browser to redirect to "url"
-function ffluci.http.redirect(url, qs)
-       if qs then
-               url = url .. "?" .. qs
-       end
-       
-       ffluci.http.set_status(302, "Found")
-       print("Location: " .. url .. "\n")
-end
-
-
--- Set Content-Type
-function ffluci.http.set_content_type(type)
-       print("Content-Type: "..type.."\n")
+function ffluci.http.redirect(url)
+       ffluci.http.status(302, "Found")
+       ffluci.http.header("Location", url)
+       print()
 end
 
 -- Sets HTTP-Status-Header
-function ffluci.http.set_status(code, message)
+function ffluci.http.status(code, message)
        print("Status: " .. tostring(code) .. " " .. message)
 end