summaryrefslogtreecommitdiff
path: root/grpc/src/core/lib/matchers/matchers.cc
diff options
context:
space:
mode:
Diffstat (limited to 'grpc/src/core/lib/matchers/matchers.cc')
-rw-r--r--grpc/src/core/lib/matchers/matchers.cc30
1 files changed, 9 insertions, 21 deletions
diff --git a/grpc/src/core/lib/matchers/matchers.cc b/grpc/src/core/lib/matchers/matchers.cc
index 489a4808..12f509b1 100644
--- a/grpc/src/core/lib/matchers/matchers.cc
+++ b/grpc/src/core/lib/matchers/matchers.cc
@@ -32,14 +32,12 @@ absl::StatusOr<StringMatcher> StringMatcher::Create(Type type,
absl::string_view matcher,
bool case_sensitive) {
if (type == Type::kSafeRegex) {
- RE2::Options options;
- options.set_case_sensitive(case_sensitive);
- auto regex_matcher = absl::make_unique<RE2>(std::string(matcher), options);
+ auto regex_matcher = absl::make_unique<RE2>(std::string(matcher));
if (!regex_matcher->ok()) {
return absl::InvalidArgumentError(
"Invalid regex string specified in matcher.");
}
- return StringMatcher(std::move(regex_matcher), case_sensitive);
+ return StringMatcher(std::move(regex_matcher));
} else {
return StringMatcher(type, matcher, case_sensitive);
}
@@ -49,19 +47,13 @@ StringMatcher::StringMatcher(Type type, absl::string_view matcher,
bool case_sensitive)
: type_(type), string_matcher_(matcher), case_sensitive_(case_sensitive) {}
-StringMatcher::StringMatcher(std::unique_ptr<RE2> regex_matcher,
- bool case_sensitive)
- : type_(Type::kSafeRegex),
- regex_matcher_(std::move(regex_matcher)),
- case_sensitive_(case_sensitive) {}
+StringMatcher::StringMatcher(std::unique_ptr<RE2> regex_matcher)
+ : type_(Type::kSafeRegex), regex_matcher_(std::move(regex_matcher)) {}
StringMatcher::StringMatcher(const StringMatcher& other)
: type_(other.type_), case_sensitive_(other.case_sensitive_) {
if (type_ == Type::kSafeRegex) {
- RE2::Options options;
- options.set_case_sensitive(other.case_sensitive_);
- regex_matcher_ =
- absl::make_unique<RE2>(other.regex_matcher_->pattern(), options);
+ regex_matcher_ = absl::make_unique<RE2>(other.regex_matcher_->pattern());
} else {
string_matcher_ = other.string_matcher_;
}
@@ -70,10 +62,7 @@ StringMatcher::StringMatcher(const StringMatcher& other)
StringMatcher& StringMatcher::operator=(const StringMatcher& other) {
type_ = other.type_;
if (type_ == Type::kSafeRegex) {
- RE2::Options options;
- options.set_case_sensitive(other.case_sensitive_);
- regex_matcher_ =
- absl::make_unique<RE2>(other.regex_matcher_->pattern(), options);
+ regex_matcher_ = absl::make_unique<RE2>(other.regex_matcher_->pattern());
} else {
string_matcher_ = other.string_matcher_;
}
@@ -151,9 +140,8 @@ std::string StringMatcher::ToString() const {
return absl::StrFormat("StringMatcher{contains=%s%s}", string_matcher_,
case_sensitive_ ? "" : ", case_sensitive=false");
case Type::kSafeRegex:
- return absl::StrFormat("StringMatcher{safe_regex=%s%s}",
- regex_matcher_->pattern(),
- case_sensitive_ ? "" : ", case_sensitive=false");
+ return absl::StrFormat("StringMatcher{safe_regex=%s}",
+ regex_matcher_->pattern());
default:
return "";
}
@@ -303,7 +291,7 @@ bool HeaderMatcher::Match(
match = value.has_value() == present_match_;
} else if (!value.has_value()) {
// All other types fail to match if field is not present.
- match = false;
+ return false;
} else if (type_ == Type::kRange) {
int64_t int_value;
match = absl::SimpleAtoi(value.value(), &int_value) &&