diff options
author | Steven Barth <steven@midlink.org> | 2008-06-16 19:53:48 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-06-16 19:53:48 +0000 |
commit | 37ab75aea57a2b5390568b561ce9fe6d7de37f56 (patch) | |
tree | 83d2082388843cbb037cbf9b56222d7a8f69a0ca /libs/httpd/luasrc/httpd.lua | |
parent | dfe85d7e518cc35a55e372b0ac31345788a486a8 (diff) |
* Removed it
Diffstat (limited to 'libs/httpd/luasrc/httpd.lua')
-rw-r--r-- | libs/httpd/luasrc/httpd.lua | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/libs/httpd/luasrc/httpd.lua b/libs/httpd/luasrc/httpd.lua deleted file mode 100644 index 773d3c873..000000000 --- a/libs/httpd/luasrc/httpd.lua +++ /dev/null @@ -1,84 +0,0 @@ ---[[ -LuCI - HTTPD -]]-- -module("luci.httpd", package.seeall) -require("luci.copas") -require("luci.http.protocol") -require("luci.sys") - - - -function run(config) - -- TODO: process config - local server = socket.bind("0.0.0.0", 8080) - copas.addserver(server, spawnworker) - - while true do - copas.step() - end -end - - -function spawnworker(socket) - socket = copas.wrap(socket) - local request = luci.http.protocol.parse_message_header(socket) - request.input = socket -- TODO: replace with streamreader - request.error = io.stderr - - - local output = socket -- TODO: replace with streamwriter - - -- TODO: detect matching handler - local h = luci.httpd.FileHandler.SimpleHandler(luci.sys.libpath() .. "/httpd/httest") - h:process(request, output) -end - - -Response = luci.util.class() -function Response.__init__(self, sourceout, headers, status) - self.sourceout = sourceout or function() end - self.headers = headers or {} - self.status = status or 200 -end - -function Response.addheader(self, key, value) - self.headers[key] = value -end - -function Response.setstatus(self, status) - self.status = status -end - -function Response.setsource(self, source) - self.sourceout = source -end - - -Handler = luci.util.class() -function Handler.__init__(self) - self.filter = {} -end - -function Handler.addfilter(self, filter) - table.insert(self.filter, filter) -end - -function Handler.process(self, request, output) - -- TODO: Process input filters - - local response = self:handle(request) - - -- TODO: Process output filters - - output:send("HTTP/1.0 " .. response.status .. " BLA\r\n") - for k, v in pairs(response.headers) do - output:send(k .. ": " .. v .. "\r\n") - end - - output:send("\r\n") - - for chunk in response.sourceout do - output:send(chunk) - end -end - |