+++ /dev/null
-include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+++ /dev/null
-function initialize()
- pcall(function()
- local SYSROOT = os.getenv("LUCI_SYSROOT")
- require "uci"
- require "luci.model.uci".cursor = function(config, save)
- return uci.cursor(config or SYSROOT .. "/etc/config", save or SYSROOT .. "/tmp/.uci")
- end
-
- local x = require "luci.uvl".UVL.__init__
- require "luci.uvl".UVL.__init__ = function(self, schemedir)
- x(self, schemedir or SYSROOT .. "/lib/uci/schema")
- end
-
- require("luci.sys")
- luci.sys.user.checkpasswd = function() return true end
-
- require "luci.dispatcher"
- require "luci.uvl"
- require "luci.cbi"
- require "luci.template"
- require "luci.json"
- end)
-end
-
--- Initialize LuCI
-function register()
- local lucihnd = require "luci.ttpd.handler.luci"
- httpd.server:get_default_vhost():set_handler("/luci", lucihnd.Luci())
-end
\ No newline at end of file
+++ /dev/null
---[[
-
-HTTP server implementation for LuCI - luci handler
-(c) 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-$Id$
-
-]]--
-local dsp = require "luci.dispatcher"
-local util = require "luci.util"
-local http = require "luci.http"
-local ltn12 = require "luci.ltn12"
-local mod = require "luci.ttpd.module"
-local table = require "table"
-local coroutine = require "coroutine"
-
-module "luci.ttpd.handler.luci"
-
-Luci = util.class(mod.Handler)
-Response = mod.Response
-
-function Luci.__init__(self, limit)
- mod.Handler.__init__(self)
-end
-
-function Luci.handle_head(self, ...)
- return (self:handle_get(...))
-end
-
-function Luci.handle_post(self, ...)
- return self:handle_get(...)
-end
-
-function Luci.handle_get(self, request, sourcein, sinkerr)
- local r = http.Request(
- request.env,
- sourcein,
- sinkerr
- )
-
- local res, id, data1, data2 = true, 0, nil, nil
- local headers = {}
- local status = 200
- local active = true
-
- local x = coroutine.create(dsp.httpdispatch)
- while not id or id < 3 do
- res, id, data1, data2 = coroutine.resume(x, r)
-
- if not res then
- status = 500
- headers["Content-Type"] = "text/plain"
- local err = {id}
- return Response( status, headers ), function() return table.remove(err) end
- end
-
- if id == 1 then
- status = data1
- elseif id == 2 then
- headers[data1] = data2
- end
- end
-
- local function iter()
- local res, id, data = coroutine.resume(x)
- if not res then
- return nil, id
- elseif not id or not active then
- return true
- elseif id == 5 then
- active = false
-
- while (coroutine.resume(x)) do
- end
-
- return nil
- elseif id == 4 then
- return data
- end
- if coroutine.status(x) == "dead" then
- return nil
- end
- end
-
- return Response(status, headers), iter
-end
+++ /dev/null
--- Initialize LuCI
-function initialize()
- pcall(function()
- require "luci.dispatcher"
- require "luci.uvl"
- require "luci.cbi"
- require "luci.template"
- require "luci.json"
- end)
-end
-
--- Register luci
-function register()
- local lucihnd = require "luci.ttpd.handler.luci".Luci()
- httpd.server:get_default_vhost():set_handler("/luci", lucihnd)
- httpd.server:get_default_vhost():set_handler("/cgi-bin/luci", lucihnd)
-end
+++ /dev/null
-include ../../build/config.mk
-include ../../build/module.mk
\ No newline at end of file
+++ /dev/null
---[[
-LuCI - SGI-Module for WSAPI
-
-Description:
-Server Gateway Interface for WSAPI
-
-FileId:
-$Id$
-
-License:
-Copyright 2008 Steven Barth <steven@midlink.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-]]--
-module("luci.sgi.wsapi", package.seeall)
-local ltn12 = require("luci.ltn12")
-require("luci.http")
-require("luci.dispatcher")
-require("luci.http.protocol")
-
-function run(wsapi_env)
- local r = luci.http.Request(
- wsapi_env,
- ltn12.source.file(wsapi_env.input),
- ltn12.sink.file(wsapi_env.error)
- )
-
- local res, id, data1, data2 = true, 0, nil, nil
- local headers = {}
- local status = 200
-
- local x = coroutine.create(luci.dispatcher.httpdispatch)
- local active = true
-
- while id < 3 do
- res, id, data1, data2 = coroutine.resume(x, r)
-
- if not res then
- status = 500
- headers["Content-Type"] = "text/plain"
- local err = {id}
- return status, headers, function() local x = table.remove(err) return x end
- end
-
- if id == 1 then
- status = data1
- elseif id == 2 then
- headers[data1] = data2
- end
- end
-
- local function iter()
- local res, id, data = coroutine.resume(x)
- if id == 4 and active then
- return data
- elseif id == 5 then
- active = false
- return ""
- else
- return ""
- end
- if coroutine.status(x) == "dead" then
- return nil
- end
- end
-
- return status, headers, iter
-end