From 73a6afb6d7dec1da25fb60a8bf208cf6c419fe92 Mon Sep 17 00:00:00 2001 From: Pixel Date: Fri, 17 Oct 2008 18:26:38 -0700 Subject: Fixing various regex issues with the new matches method. --- lib/LuaHttp.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/LuaHttp.cc') diff --git a/lib/LuaHttp.cc b/lib/LuaHttp.cc index a3c728a..e9dc90d 100644 --- a/lib/LuaHttp.cc +++ b/lib/LuaHttp.cc @@ -398,7 +398,7 @@ LuaDomain::~LuaDomain() { } void LuaDomain::Do(const HttpRequest & req, HttpResponse * res) throw (GeneralException) { - int i; + int i, nmatches = 1; Lua * oldL = L; Lua * L = oldL->thread(true); @@ -489,9 +489,10 @@ void LuaDomain::Do(const HttpRequest & req, HttpResponse * res) throw (GeneralEx L->push("matches"); L->newtable(); - for (i = 0; i < MAX_MATCHES; i++) { + for (i = 1; i < MAX_MATCHES; i++) { if (req.pmatches[i].rm_so == -1) continue; + L->push((lua_Number) nmatches++); L->newtable(); L->push("start"); L->push((lua_Number) req.pmatches[i].rm_so + 1); @@ -501,6 +502,7 @@ void LuaDomain::Do(const HttpRequest & req, HttpResponse * res) throw (GeneralEx L->settable(); L->settable(); } + L->settable(); LuaHttpResponse r(res); r.push(L); -- cgit v1.2.3