bneradt commented on code in PR #12572:
URL: https://github.com/apache/trafficserver/pull/12572#discussion_r2452615248
##########
plugins/experimental/access_control/pattern.cc:
##########
@@ -214,22 +195,13 @@ Pattern::process(const String &subject, StringVector
&result)
bool
Pattern::match(const String &subject)
{
- int matchCount;
AccessControlDebug("matching '%s' to '%s'", _pattern.c_str(),
subject.c_str());
- if (!_re) {
- return false;
- }
-
- matchCount = pcre_exec(_re, _extra, subject.c_str(), subject.length(), 0,
PCRE_NOTEMPTY, nullptr, 0);
- if (matchCount < 0) {
- if (matchCount != PCRE_ERROR_NOMATCH) {
- AccessControlError("matching error %d", matchCount);
- }
+ if (!_re || _re->empty()) {
return false;
}
- return true;
+ return _re->exec(subject);
Review Comment:
Isn't NOTEMPTY the default?
```cpp
enum REFlags {
RE_CASE_INSENSITIVE = 0x00000008u, ///< Ignore case (default: case
sensitive).
RE_UNANCHORED = 0x00000400u, ///< Unanchored (DFA defaults to
anchored).
RE_ANCHORED = 0x80000000u, ///< Anchored (Regex defaults to
unanchored).
RE_NOTEMPTY = 0x00000004u ///< Not empty (default: may match
empty string).
};
```
--
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]