Remove overload protection from SDK httpd
[project/luci.git] / libs / httpd / luasrc / httpd / handler / luci.lua
index ac3ed78..8ccf7c8 100644 (file)
@@ -27,7 +27,7 @@ function Luci.__init__(self, limit)
        luci.httpd.module.Handler.__init__(self)
        self.limit = limit or 5
        self.running = {}
-       setmetatable(self.running, {__mode = "v"})
+       setmetatable(self.running, {__mode = "k"})
 end
 
 function Luci.handle_head(self, ...)
@@ -40,11 +40,6 @@ function Luci.handle_post(self, ...)
 end
 
 function Luci.handle_get(self, request, sourcein, sinkerr)
-       if self.limit and #self.running >= self.limit then
-               return self:failure(503, "Overload")
-       end
-       table.insert(self.running, coroutine.running())
-       
        local r = luci.http.Request(
                request.env,
                sourcein,
@@ -84,7 +79,11 @@ function Luci.handle_get(self, request, sourcein, sinkerr)
                        return true
                elseif id == 5 then
                        active = false
-                       return true
+
+                       while (coroutine.resume(x)) do
+                       end
+
+                       return nil
                elseif id == 4 then
                        return data
                end
@@ -93,9 +92,5 @@ function Luci.handle_get(self, request, sourcein, sinkerr)
                end
        end
 
-       headers["Expires"] = luci.http.protocol.date.to_http( os.time() )
-       headers["Date"]    = headers["Expires"]
-       headers["Cache-Control"] = "no-cache"
-
        return Response(status, headers), iter
 end