summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/tasklib.lua16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/tasklib.lua b/lib/tasklib.lua
index fda990c..fc2ce51 100644
--- a/lib/tasklib.lua
+++ b/lib/tasklib.lua
@@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: tasklib.lua,v 1.5 2007-10-15 13:46:33 pixel Exp $ */
+/* $Id: tasklib.lua,v 1.6 2008-02-15 15:01:52 pixel Exp $ */
]]--
@@ -27,15 +27,23 @@
-- Create some simple bindings for the LuaTask system to hide the various ugly yields.
--
+local nb_clients = 0
+
function HttpClient(url, headers, vars)
+ if nb_clients >= 5 then
+ return Buffer()
+ end
+ nb_clients = nb_clients + 1
if type(headers) == "nil" then
- headers = {}
+ headers = {}
end
if type(vars) == "nil" then
- vars = {}
+ vars = {}
end
headers["User-Agent"] = "Mozilla/5.0 (Windows; U; Windows NT 5.1; fr; rv:1.8.1) Gecko/20061010 Firefox/2.0"
- return coroutine.yield("HttpClient", url, headers, vars)
+ local r = coroutine.yield("HttpClient", url, headers, vars)
+ nb_clients = nb_clients - 1
+ return r
end
function MailClient(smtp, subject, from, headers, tos, ccs, bccs, fakes, body)