summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/http.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-22 20:04:49 +0000
committerSteven Barth <steven@midlink.org>2008-08-22 20:04:49 +0000
commit03c0b0ad120c83f80d94e1e4233a6b4bd6eaf3e9 (patch)
tree5942fe3525fdf26a36f14a847c58f4032445bfa8 /libs/web/luasrc/http.lua
parent4eead17501584a09679841d75d451b19a7c234d0 (diff)
RPC part #3
Diffstat (limited to 'libs/web/luasrc/http.lua')
-rw-r--r--libs/web/luasrc/http.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/libs/web/luasrc/http.lua b/libs/web/luasrc/http.lua
index 5b922d994..17b27482e 100644
--- a/libs/web/luasrc/http.lua
+++ b/libs/web/luasrc/http.lua
@@ -81,6 +81,14 @@ function Request.formvaluetable(self, prefix)
return vals
end
+function Request.content(self)
+ if not self.parsed_input then
+ self:_parse_input()
+ end
+
+ return self.message.content, self.message.content_length
+end
+
function Request.getcookie(self, name)
local c = string.gsub(";" .. (self:getenv("HTTP_COOKIE") or "") .. ";", "%s*;%s*", ";")
local p = ";" .. name .. "=(.-);"
@@ -122,6 +130,13 @@ function close()
end
end
+--- Return the request content if the request was of unknown type.
+-- @return HTTP request body
+-- @return HTTP request body length
+function content()
+ return context.request:content()
+end
+
--- Get a certain HTTP input value or a table of all input values.
-- @param name Name of the GET or POST variable to fetch
-- @param noparse Don't parse POST data before getting the value