diff options
-rw-r--r-- | libs/json/Makefile (renamed from libs/rpc/Makefile) | 0 | ||||
-rw-r--r-- | libs/json/luasrc/json.lua (renamed from libs/rpc/luasrc/Json.lua) | 4 | ||||
-rw-r--r-- | libs/web/luasrc/http.lua | 15 |
3 files changed, 17 insertions, 2 deletions
diff --git a/libs/rpc/Makefile b/libs/json/Makefile index f7fac7740..f7fac7740 100644 --- a/libs/rpc/Makefile +++ b/libs/json/Makefile diff --git a/libs/rpc/luasrc/Json.lua b/libs/json/luasrc/json.lua index 1dbc65c65..85b85e1e8 100644 --- a/libs/rpc/luasrc/Json.lua +++ b/libs/json/luasrc/json.lua @@ -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 = {} 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 |