MCPcopy Create free account
hub / github.com/apache/trafficserver / set

Method set

plugins/header_rewrite/matcher.cc:31–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29// Special case for strings, to make the distinction between regexes and string matching
30template <>
31void
32Matchers<std::string>::set(const std::string &d, CondModifiers mods)
33{
34 _data = d;
35 if (mods & COND_NOCASE) {
36 _nocase = true;
37 }
38
39 if (_op == MATCH_REGULAR_EXPRESSION) {
40 if (!_reHelper.setRegexMatch(_data, _nocase)) {
41 std::stringstream ss;
42
43 ss << _data;
44 TSError("[%s] Invalid regex: failed to precompile: %s", PLUGIN_NAME, ss.str().c_str());
45 Dbg(pi_dbg_ctl, "Invalid regex: failed to precompile: %s", ss.str().c_str());
46 throw std::runtime_error("Malformed regex");
47 } else {
48 Dbg(pi_dbg_ctl, "Regex precompiled successfully");
49 }
50 }
51}
52
53// Special case for strings, to allow for insensitive case comparisons for std::string matchers.
54template <>

Callers 1

initializeMethod · 0.45

Calls 4

TSErrorFunction · 0.70
setRegexMatchMethod · 0.45
c_strMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected