summaryrefslogtreecommitdiffhomepage
path: root/libs/lucittpd/root/usr
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-11-30 13:19:45 +0000
committerSteven Barth <steven@midlink.org>2008-11-30 13:19:45 +0000
commitb33943a6e8596c1ddfc1b771a995d3cf21e81cd6 (patch)
tree6f67cdea044e708a599a06712491b5c60db6f954 /libs/lucittpd/root/usr
parenta7e7c31f8c659b55c1adb0863a8f2f66d3452d2b (diff)
Merge LuCIttpd
Diffstat (limited to 'libs/lucittpd/root/usr')
-rw-r--r--libs/lucittpd/root/usr/lib/lucittpd/plugins/httpd.lua35
1 files changed, 35 insertions, 0 deletions
diff --git a/libs/lucittpd/root/usr/lib/lucittpd/plugins/httpd.lua b/libs/lucittpd/root/usr/lib/lucittpd/plugins/httpd.lua
new file mode 100644
index 0000000000..2d3a9d8c87
--- /dev/null
+++ b/libs/lucittpd/root/usr/lib/lucittpd/plugins/httpd.lua
@@ -0,0 +1,35 @@
+function initialize()
+ local lucittpd = require "luci.ttpd.server"
+ server = lucittpd.Server(lucittpd.VHost())
+end
+
+function register()
+ local filehnd = require "luci.ttpd.handler.file"
+ local uci = require "luci.model.uci".cursor()
+ local filehandler = filehnd.Simple((uci:get("lucittpd", "lucittpd", "root") or "/www"))
+ server:get_default_vhost():set_default_handler(filehandler)
+end
+
+function accept()
+ server:process({
+ _read = function(...)
+ local chunk, err = webuci_read(...)
+ return chunk or (err and error(err, 0))
+ end,
+
+ _write = function(...)
+ local chunk, err = webuci_write(...)
+ return chunk or (err and error(err, 0))
+ end,
+
+ _close = function(...)
+ local chunk, err = webuci_close(...)
+ return chunk or (err and error(err, 0))
+ end,
+
+ _sendfile = function(...)
+ local chunk, err = webuci_sendfile(...)
+ return chunk or (err and error(err, 0))
+ end
+ })
+end