http_rewrite: Avoid ?<group> regex'es.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 19 Jun 2013 09:26:21 +0000 (11:26 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 19 Jun 2013 09:26:21 +0000 (11:26 +0200)
They don't work in Boost 1.33 (rather old).

src/filter_http_rewrite.cpp

index 1581694..d21b4c8 100644 (file)
@@ -256,9 +256,11 @@ void yf::HttpRewrite::Rule::parse_groups()
     int gnum = 0;
     bool esc = false;
     const std::string & str = regex;
+    std::string res;
     yaz_log(YLOG_LOG, "Parsing groups from '%s'", str.c_str());
     for (size_t i = 0; i < str.size(); ++i)
     {
+        res += str[i];
         if (!esc && str[i] == '\\')
         {
             esc = true;
@@ -273,7 +275,9 @@ void yf::HttpRewrite::Rule::parse_groups()
                 if (i+1 < str.size() && str[i+1] == ':') //non-capturing
                 {
                     if (gnum > 0) gnum--;
+                    res += str[i];
                     i++;
+                    res += str[i];
                     continue;
                 }
                 if (i+1 < str.size() && str[i+1] == 'P') //optional, python
@@ -307,6 +311,7 @@ void yf::HttpRewrite::Rule::parse_groups()
         }
         esc = false;
     }
+    regex = res;
 }
 
 std::string yf::HttpRewrite::Rule::sub_vars (