luci/applications/luci-splash/root/usr/bin/luci-splashd
Steven Barth 67fbe1b33c Remove Luasocket - obsoleted by nixio
Remove old luasocket based LuCI Httpd - obsoleted by lucittpd
Remove lpeg - not in use
Rewrite luci-splashd using nixio
2009-05-01 11:28:34 +00:00

20 lines
469 B
Lua
Executable file

#!/usr/bin/lua
local nixio = require "nixio"
local server = nixio.bind(nil, arg[1] or 8082)
local stat = server:listen(32)
while stat do
local client = server:accept()
if client then
client:setopt("socket", "rcvtimeo", 1)
client:setopt("socket", "sndtimeo", 1)
local srv = client:getsockname()
client:read(1024)
client:writeall("HTTP/1.0 302 Found\r\nLocation: http://" .. srv ..
(arg[2] or "/luci/splash") .. "\r\n\r\n")
client:close()
end
end