Remove old luasocket based LuCI Httpd - obsoleted by lucittpd Remove lpeg - not in use Rewrite luci-splashd using nixio
20 lines
469 B
Lua
Executable file
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
|