summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/http.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-06-28 16:03:54 +0000
committerSteven Barth <steven@midlink.org>2008-06-28 16:03:54 +0000
commit00aceaf624d8e5da2a8f3df161d52599aae2ac41 (patch)
treec18d8c411f8d4a02762a478348fd8a86b4f56f5a /libs/web/luasrc/http.lua
parent7f56bf947599b20e2cf50018e160e602d5516e5f (diff)
* libs/web: Switched from HTTP-Basic-Auth to Session-Auth
* Updated Makefiles for better testing environment integration * Fixed libs/sgi-luci
Diffstat (limited to 'libs/web/luasrc/http.lua')
-rw-r--r--libs/web/luasrc/http.lua15
1 files changed, 8 insertions, 7 deletions
diff --git a/libs/web/luasrc/http.lua b/libs/web/luasrc/http.lua
index 37050e478..f37d67343 100644
--- a/libs/web/luasrc/http.lua
+++ b/libs/web/luasrc/http.lua
@@ -51,13 +51,13 @@ function Request.__init__(self, env, sourcein, sinkerr)
self.parsed_input = false
end
-function Request.formvalue(self, name, default)
+function Request.formvalue(self, name)
if not self.parsed_input then
self:_parse_input()
end
if name then
- return self.message.params[name] and tostring(self.message.params[name]) or default
+ return self.message.params[name]
else
return self.message.params
end
@@ -84,7 +84,7 @@ end
function Request.getcookie(self, name)
local c = string.gsub(";" .. (self:getenv("HTTP_COOKIE") or "") .. ";", "%s*;%s*", ";")
local p = ";" .. name .. "=(.-);"
- local i, j, value = cookies:find(p)
+ local i, j, value = c:find(p)
return value and urldecode(value)
end
@@ -130,6 +130,10 @@ function formvaluetable(...)
return context.request:formvaluetable(...)
end
+function getcookie(...)
+ return context.request:getcookie(...)
+end
+
function getvalue(...)
return context.request:getvalue(...)
end
@@ -147,9 +151,6 @@ function setfilehandler(...)
end
function header(key, value)
- if not context.status then
- status()
- end
if not context.headers then
context.headers = {}
end
@@ -187,7 +188,7 @@ function write(content)
end
function redirect(url)
- header("Status", "302 Found")
+ status(302, "Found")
header("Location", url)
close()
end