summaryrefslogtreecommitdiffhomepage
path: root/libs/httpd/host/runluci
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-06-23 18:17:02 +0000
committerSteven Barth <steven@midlink.org>2008-06-23 18:17:02 +0000
commit4f630d647c7191ac9d8fd2dfcc8e93746faf391a (patch)
tree76bb12773e833e38c69ee43f006b78f0e84ab748 /libs/httpd/host/runluci
parenta038da390d7fd3a75b5a1045afbb4d9782556c57 (diff)
* Introducing LuCI HTTPD as testing environment
* Several coroutine-safety fixes
Diffstat (limited to 'libs/httpd/host/runluci')
-rwxr-xr-xlibs/httpd/host/runluci32
1 files changed, 32 insertions, 0 deletions
diff --git a/libs/httpd/host/runluci b/libs/httpd/host/runluci
new file mode 100755
index 0000000000..c9c93dde84
--- /dev/null
+++ b/libs/httpd/host/runluci
@@ -0,0 +1,32 @@
+#!/usr/bin/lua
+require("luci.httpd")
+require("luci.httpd.server")
+require("luci.httpd.handler.file")
+require("luci.httpd.handler.luci")
+
+DOCROOT = arg[1]
+PORT = 8080
+
+
+serversocket = luci.httpd.Socket("0.0.0.0", PORT)
+
+
+server = luci.httpd.server.Server()
+vhost = luci.httpd.server.VHost()
+
+server:set_default_vhost(vhost)
+
+
+filehandler = luci.httpd.handler.file.Simple(DOCROOT)
+vhost:set_default_handler(filehandler)
+
+lucihandler = luci.httpd.handler.luci.Luci()
+vhost:set_handler("/luci", lucihandler)
+
+io.stderr:write("Starting LuCI HTTPD on port " .. PORT .. "...\n")
+io.stderr:write("Point your browser to http://localhost:" .. PORT .. "/luci\n")
+
+daemon = luci.httpd.Daemon()
+daemon.debug = true
+daemon:register(serversocket, server:create_daemon_handlers())
+daemon:run()