diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/LuaTask.cc | 13 | ||||
-rw-r--r-- | lib/tasklib.lua | 6 |
2 files changed, 14 insertions, 5 deletions
diff --git a/lib/LuaTask.cc b/lib/LuaTask.cc index 331e081..6a73f2b 100644 --- a/lib/LuaTask.cc +++ b/lib/LuaTask.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: LuaTask.cc,v 1.29 2008-05-14 01:39:31 pixel Exp $ */ +/* $Id: LuaTask.cc,v 1.30 2008-07-22 14:33:42 pixel Exp $ */ #include <LuaTask.h> #include <LuaHandle.h> @@ -120,7 +120,16 @@ int LuaTask::Do() throw (GeneralException) { if (task == "HttpClient") { LuaBuffer o(b); o.pushdestruct(L); - nargs = 1; + L->newtable(); + HttpClient * x = dynamic_cast<HttpClient *>(c); + int n = 1; + for (t_headers::iterator i = x->reply_headers.begin(); i != x->reply_headers.end(); i++) { + L->push((lua_Number) n++); + L->push(*i); + L->settable(); + } + L->push(x->GetStatus()); + nargs = 3; } #endif diff --git a/lib/tasklib.lua b/lib/tasklib.lua index 75ea94a..9471990 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.9 2008-05-14 01:39:31 pixel Exp $ */ +/* $Id: tasklib.lua,v 1.10 2008-07-22 14:33:42 pixel Exp $ */ ]]-- @@ -48,11 +48,11 @@ function HttpClient(url, headers, 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" - local r = coroutine.yield("HttpClient", url, headers, vars) + local r, h, s = coroutine.yield("HttpClient", url, headers, vars) if host then nb_clients_per_hosts[host] = nb_clients_per_hosts[host] - 1 end - return r + return r, h, s end function MaxNbClients(n) |