RPC part #3
authorSteven Barth <redacted>
Fri, 22 Aug 2008 20:04:49 +0000 (20:04 +0000)
committerSteven Barth <redacted>
Fri, 22 Aug 2008 20:04:49 +0000 (20:04 +0000)
libs/json/Makefile [moved from libs/rpc/Makefile with 100% similarity]
libs/json/luasrc/json.lua [moved from libs/rpc/luasrc/Json.lua with 99% similarity]
libs/web/luasrc/http.lua

similarity index 100%
rename from libs/rpc/Makefile
rename to libs/json/Makefile
similarity index 99%
rename from libs/rpc/luasrc/Json.lua
rename to libs/json/luasrc/json.lua
index 1dbc65c65ad1959dc26abf5af0181578722bf87c..85b85e1e890e9e2714116e4d265a64922be66b2e 100644 (file)
@@ -2,7 +2,7 @@
 
  JSON Encoder and Parser for Lua 5.1
  
- Copyright © 2007 Shaun Brown (http://www.chipmunkav.com).
+ Copyright  2007 Shaun Brown (http://www.chipmunkav.com).
  All Rights Reserved.
  
  Permission is hereby granted, free of charge, to any person 
@@ -66,7 +66,7 @@ local ipairs = ipairs
 local assert = assert
 local Chipmunk = Chipmunk
 
-module("Json")
+module("luci.json")
 
 local StringBuilder = {
        buffer = {}
index 5b922d99438b14863b87b8b8901c8f6fc7e97cbe..17b27482e40c22e72471bf765b8f01dcdd6748e7 100644 (file)
@@ -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
git clone https://git.99rst.org/PROJECT