summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/http.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-08-29 23:26:01 +0000
committerSteven Barth <steven@midlink.org>2008-08-29 23:26:01 +0000
commitffd5c4ec656bd3f216c66b43587abcfdaf2b5c37 (patch)
tree243656197dd59fbb2b8d3d0af8928bf8700c26ed /libs/web/luasrc/http.lua
parent5cfda95377accd59f488868180b17ca86327839d (diff)
General optimizations, simplifications and improvements
Diffstat (limited to 'libs/web/luasrc/http.lua')
-rw-r--r--libs/web/luasrc/http.lua25
1 files changed, 15 insertions, 10 deletions
diff --git a/libs/web/luasrc/http.lua b/libs/web/luasrc/http.lua
index b1ffac2be..6b73b9414 100644
--- a/libs/web/luasrc/http.lua
+++ b/libs/web/luasrc/http.lua
@@ -24,15 +24,20 @@ limitations under the License.
]]--
+local ltn12 = require "luci.ltn12"
+local proto = require "luci.http.protocol"
+local util = require "luci.util"
+local string = require "string"
+local coroutine = require "coroutine"
+
+local pairs, tostring, error = pairs, tostring, error
+
--- LuCI Web Framework high-level HTTP functions.
-module("luci.http", package.seeall)
-local ltn12 = require("luci.ltn12")
-require("luci.http.protocol")
-require("luci.util")
+module "luci.http"
-context = luci.util.threadlocal()
+context = util.threadlocal()
-Request = luci.util.class()
+Request = util.class()
function Request.__init__(self, env, sourcein, sinkerr)
self.input = sourcein
self.error = sinkerr
@@ -45,7 +50,7 @@ function Request.__init__(self, env, sourcein, sinkerr)
self.message = {
env = env,
headers = {},
- params = luci.http.protocol.urldecode_params(env.QUERY_STRING or ""),
+ params = protocol.urldecode_params(env.QUERY_STRING or ""),
}
self.parsed_input = false
@@ -109,7 +114,7 @@ function Request.setfilehandler(self, callback)
end
function Request._parse_input(self)
- luci.http.protocol.parse_message_body(
+ protocol.parse_message_body(
self.input,
self.message,
self.filehandler
@@ -277,10 +282,10 @@ end
-- @param no_plus Don't decode + to " "
-- @return URL-decoded string
-- @see urlencode
-urldecode = luci.http.protocol.urldecode
+urldecode = protocol.urldecode
--- Return the URL-encoded equivalent of a string.
-- @param str Source string
-- @return URL-encoded string
-- @see urldecode
-urlencode = luci.http.protocol.urlencode
+urlencode = protocol.urlencode