summaryrefslogtreecommitdiffhomepage
path: root/libs/web
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-06-20 19:57:57 +0000
committerSteven Barth <steven@midlink.org>2008-06-20 19:57:57 +0000
commit65870edf9f1e579b4301e1677d70c9387a9a72dc (patch)
treead34a187c824027f8e328bece03c3f67527a89f2 /libs/web
parente2e9e119d670ec80954fc8c018b479b218a7e47e (diff)
* libs/core: Added garbage collector to luci.util.threadlocal to avoid memory leaks
* libs/http: Use env-Variables instead of headers for parse_message_body and subsequent functions * libs/http: Added missing urldecode call for parsing urlencoded params * libs/web: Ported luci.http to use ltn12 sources and sinks instead of sockets or file pointers * libs/sgi-cgi, libs/sgi-webuci, libs/sgi-wsapi: Updated to work with new luci.http.Request ABI
Diffstat (limited to 'libs/web')
-rw-r--r--libs/web/luasrc/http.lua18
1 files changed, 7 insertions, 11 deletions
diff --git a/libs/web/luasrc/http.lua b/libs/web/luasrc/http.lua
index f2c366073..2bd914429 100644
--- a/libs/web/luasrc/http.lua
+++ b/libs/web/luasrc/http.lua
@@ -28,6 +28,7 @@ limitations under the License.
]]--
module("luci.http", package.seeall)
+require("ltn12")
require("luci.http.protocol")
require("luci.util")
@@ -35,15 +36,10 @@ context = luci.util.threadlocal()
Request = luci.util.class()
-function Request.__init__(self, env, instream, errstream)
- self.input = instream
- self.error = errstream
-
- -- Provide readline function
- self.inputreader = self.input.readline
- or self.input.read and function() return self.input:read() end
- or self.input.receive and function() return self.input:receive() end
- or function() return nil end
+function Request.__init__(self, env, sourcein, sinkerr)
+ self.input = sourcein
+ self.error = sinkerr
+
-- File handler
self.filehandler = function() end
@@ -52,13 +48,13 @@ function Request.__init__(self, env, instream, errstream)
self.message = {
env = env,
headers = {},
- params = luci.http.protocol.urldecode_params("?"..(env.QUERY_STRING or "")),
+ params = luci.http.protocol.urldecode_params(env.QUERY_STRING or ""),
}
setmetatable(self.message.params, {__index =
function(tbl, key)
luci.http.protocol.parse_message_body(
- self.inputreader,
+ self.input,
self.message,
self.filehandler
)