3 HTTP server implementation for LuCI - core
4 (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
20 require("luci.http.protocol")
21 require("luci.httpd.server")
24 local srv = luci.httpd.server
25 local host = "0.0.0.0"
29 server = socket.bind(host, port)
30 server:settimeout( 0, "t" )
38 local input = socket.select( reading, nil, 0.1 )
40 -- accept new connections
41 for i, connection in ipairs(input) do
43 local sock = connection:accept()
46 if #running < srv.MAX_CLIENTS then
48 table.insert( running, {
49 coroutine.create( srv.client_handler ),
59 -- create client handler
60 for i, client in ipairs( running ) do
63 if coroutine.status( client[1] ) == "dead" then
64 table.remove( running, i )
67 coroutine.resume( client[1], client[2] )