bryancall commented on code in PR #12551:
URL: https://github.com/apache/trafficserver/pull/12551#discussion_r2414981240


##########
src/proxy/ControlMatcher.cc:
##########
@@ -476,13 +476,15 @@ RegexMatcher<Data, MatchResult>::Match(RequestData 
*rdata, MatchResult *result)
   // The function unescapifyStr() is already called in
   // HttpRequestData::get_string(); therefore, no need to call again here.
   for (int i = 0; i < num_el; i++) {
-    if (regex_array[i].exec(url_str) == true) {
+    RegexMatches matches;
+    int          r = regex_array[i].exec(url_str, matches);
+    if (r > 0) {

Review Comment:
   This was `if (r > -1) {` before



##########
src/proxy/ControlMatcher.cc:
##########
@@ -521,14 +523,16 @@ HostRegexMatcher<Data, MatchResult>::Match(RequestData 
*rdata, MatchResult *resu
     url_str = "";
   }
   for (int i = 0; i < num_el; i++) {
-    if (this->regex_array[i].exec(url_str) == true) {
+    RegexMatches matches;
+    int          r = this->regex_array[i].exec(url_str, matches);
+    if (r > 0) {

Review Comment:
   This logic was a little funky before it was:
   ```
       r = pcre_exec(this->re_array[i], nullptr, url_str, strlen(url_str), 0, 
0, nullptr, 0);
       if (r != -1) {
         Dbg(dbg_ctl_matcher, "%s Matched %s with regex at line %d", 
const_cast<char *>(this->matcher_name), url_str,
             this->data_array[i].line_num);
         this->data_array[i].UpdateMatch(result, rdata);
       } else {
         // An error has occurred
         Warning("error matching regex at line %d", 
this->data_array[i].line_num);
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to