From b33943a6e8596c1ddfc1b771a995d3cf21e81cd6 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sun, 30 Nov 2008 13:19:45 +0000 Subject: Merge LuCIttpd --- .../hostfiles/usr/lib/lucittpd/plugins/httpd.lua | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 libs/lucittpd/hostfiles/usr/lib/lucittpd/plugins/httpd.lua (limited to 'libs/lucittpd/hostfiles/usr/lib') diff --git a/libs/lucittpd/hostfiles/usr/lib/lucittpd/plugins/httpd.lua b/libs/lucittpd/hostfiles/usr/lib/lucittpd/plugins/httpd.lua new file mode 100644 index 0000000000..e40af98fd9 --- /dev/null +++ b/libs/lucittpd/hostfiles/usr/lib/lucittpd/plugins/httpd.lua @@ -0,0 +1,34 @@ +function initialize() + local lucittpd = require "luci.ttpd.server" + server = lucittpd.Server(lucittpd.VHost()) +end + +function register() + local filehnd = require "luci.ttpd.handler.file" + local filehandler = filehnd.Simple(os.getenv("LUCI_SYSROOT") .. "/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 \ No newline at end of file -- cgit v1.2.3