diff options
| -rw-r--r-- | lib/LuaHttp.cc | 6 | ||||
| -rw-r--r-- | lib/LuaRegex.cc | 2 | ||||
| -rw-r--r-- | lib/Regex.cc | 4 | 
3 files changed, 7 insertions, 5 deletions
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); diff --git a/lib/LuaRegex.cc b/lib/LuaRegex.cc index e785195..61ccac7 100644 --- a/lib/LuaRegex.cc +++ b/lib/LuaRegex.cc @@ -102,7 +102,7 @@ int sLua_Regex::Regex_proceed(Lua * L, int n, Regex * reg, int caller) {  	    return 1;  	L->newtable();  	num = 1; -	for (i = 0; i < MAX_MATCHES; i++) { +	for (i = 1; i < MAX_MATCHES; i++) {  	    if (pmatches[i].rm_so == -1)  	        continue;  	    L->push((lua_Number) num++); diff --git a/lib/Regex.cc b/lib/Regex.cc index 68ccba8..470c8cf 100644 --- a/lib/Regex.cc +++ b/lib/Regex.cc @@ -30,7 +30,7 @@ Regex empty("^$"), any(".*");  Regex::Regex(const String & regex, int acflags, int aeflags) throw (GeneralException) : cflags(acflags), eflags(aeflags), pattern(regex.strdup()) {      int r; -    if ((r = regcomp(&preg, pattern, cflags | REG_NOSUB))) { +    if ((r = regcomp(&preg, pattern, cflags))) {  	std::cerr << _("Error in regcomp:");  	regerror(r, &preg, t, sizeof(t));  	std::cerr << t << std::endl; @@ -41,7 +41,7 @@ Regex::Regex(const String & regex, int acflags, int aeflags) throw (GeneralExcep  Regex::Regex(const Regex & regex) : pattern(Base::strdup(regex.pattern)), cflags(regex.cflags), eflags(regex.eflags) {      int r; -    if ((r = regcomp(&preg, pattern, cflags | REG_NOSUB))) { +    if ((r = regcomp(&preg, pattern, cflags))) {  	printm(M_ERROR, _("Error in regcomp:"));  	regerror(r, &preg, t, sizeof(t));  	printm(M_ERROR, "%s\n", t);  | 
