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

Function condition_factory

plugins/header_rewrite/factory.cc:98–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98Condition *
99condition_factory(const std::string &cond)
100{
101 Condition *c = nullptr;
102 std::string c_name, c_qual;
103 std::string::size_type pos = cond.find_first_of(':');
104
105 if (pos != std::string::npos) {
106 c_name = cond.substr(0, pos);
107 c_qual = cond.substr(pos + 1);
108 } else {
109 c_name = cond;
110 c_qual = "";
111 }
112
113 if (c_name == "TRUE") {
114 c = new ConditionTrue();
115 } else if (c_name == "FALSE") {
116 c = new ConditionFalse();
117 } else if (c_name == "STATUS") {
118 c = new ConditionStatus();
119 } else if (c_name == "RANDOM") {
120 c = new ConditionRandom();
121 } else if (c_name == "ACCESS") {
122 c = new ConditionAccess();
123 } else if (c_name == "COOKIE") {
124 c = new ConditionCookie();
125 } else if (c_name == "HEADER") { // This condition adapts to the hook
126 c = new ConditionHeader();
127 } else if (c_name == "CLIENT-HEADER") {
128 c = new ConditionHeader(true);
129 } else if (c_name == "CLIENT-URL") { // This condition adapts to the hook
130 c = new ConditionUrl(ConditionUrl::CLIENT);
131 } else if (c_name == "URL") {
132 c = new ConditionUrl(ConditionUrl::URL);
133 } else if (c_name == "FROM-URL") {
134 c = new ConditionUrl(ConditionUrl::FROM);
135 } else if (c_name == "TO-URL") {
136 c = new ConditionUrl(ConditionUrl::TO);
137 } else if (c_name == "DBM") {
138 c = new ConditionDBM();
139 } else if (c_name == "INTERNAL-TRANSACTION") {
140 c = new ConditionInternalTxn();
141 } else if (c_name == "INTERNAL-TXN") {
142 c = new ConditionInternalTxn();
143 } else if (c_name == "IP") {
144 c = new ConditionIp();
145 } else if (c_name == "METHOD") {
146 c = new ConditionMethod();
147 } else if (c_name == "TXN-COUNT") {
148 c = new ConditionTransactCount();
149 } else if (c_name == "NOW") {
150 c = new ConditionNow();
151 } else if (c_name == "GEO") {
152#if TS_USE_HRW_GEOIP
153 c = new GeoIPConditionGeo();
154#elif TS_USE_HRW_MAXMINDDB
155 c = new MMConditionGeo();

Callers 2

set_valueMethod · 0.85
make_conditionMethod · 0.85

Calls 4

TSErrorFunction · 0.70
substrMethod · 0.45
c_strMethod · 0.45
set_qualifierMethod · 0.45

Tested by

no test coverage detected