RPC part #3
This commit is contained in:
parent
4eead17501
commit
03c0b0ad12
3 changed files with 17 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
JSON Encoder and Parser for Lua 5.1
|
JSON Encoder and Parser for Lua 5.1
|
||||||
|
|
||||||
Copyright © 2007 Shaun Brown (http://www.chipmunkav.com).
|
Copyright <EFBFBD> 2007 Shaun Brown (http://www.chipmunkav.com).
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
@ -66,7 +66,7 @@ local ipairs = ipairs
|
||||||
local assert = assert
|
local assert = assert
|
||||||
local Chipmunk = Chipmunk
|
local Chipmunk = Chipmunk
|
||||||
|
|
||||||
module("Json")
|
module("luci.json")
|
||||||
|
|
||||||
local StringBuilder = {
|
local StringBuilder = {
|
||||||
buffer = {}
|
buffer = {}
|
|
@ -81,6 +81,14 @@ function Request.formvaluetable(self, prefix)
|
||||||
return vals
|
return vals
|
||||||
end
|
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)
|
function Request.getcookie(self, name)
|
||||||
local c = string.gsub(";" .. (self:getenv("HTTP_COOKIE") or "") .. ";", "%s*;%s*", ";")
|
local c = string.gsub(";" .. (self:getenv("HTTP_COOKIE") or "") .. ";", "%s*;%s*", ";")
|
||||||
local p = ";" .. name .. "=(.-);"
|
local p = ";" .. name .. "=(.-);"
|
||||||
|
@ -122,6 +130,13 @@ function close()
|
||||||
end
|
end
|
||||||
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.
|
--- 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 name Name of the GET or POST variable to fetch
|
||||||
-- @param noparse Don't parse POST data before getting the value
|
-- @param noparse Don't parse POST data before getting the value
|
||||||
|
|
Loading…
Reference in a new issue