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

Method set_value

plugins/header_rewrite/value.cc:41–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41void
42Value::set_value(const std::string &val, Statement *owner)
43{
44 _value = val;
45
46 if (_value.find("%{") != std::string::npos) {
47 HRWSimpleTokenizer tokenizer(_value);
48 auto tokens = tokenizer.get_tokens();
49
50 for (const auto &token : tokens) {
51 Condition *tcond_val = nullptr;
52
53 if (token.substr(0, 2) == "%{") {
54 std::string cond_token = token.substr(2, token.size() - 3);
55
56 if ((tcond_val = condition_factory(cond_token))) {
57 Parser parser;
58
59 if (parser.parse_line(cond_token)) {
60 tcond_val->initialize(parser);
61 require_resources(tcond_val->get_resource_ids());
62 } else {
63 // TODO: should we produce error here?
64 Dbg(dbg_ctl, "Error parsing value '%s'", _value.c_str());
65 }
66 }
67 } else {
68 tcond_val = new ConditionStringLiteral(token);
69 }
70
71 if (tcond_val) {
72 _cond_vals.push_back(tcond_val);
73 }
74 }
75
76 // If we have an owner (e.g. an Operator) hoist up the resource requirements
77 if (owner) {
78 owner->require_resources(get_resource_ids());
79 }
80 } else {
81 _int_value = strtol(_value.c_str(), nullptr, 10);
82 _float_value = strtod(_value.c_str(), nullptr);
83 }
84}

Callers 2

send_requestFunction · 0.80
initializeMethod · 0.80

Calls 10

condition_factoryFunction · 0.85
require_resourcesMethod · 0.80
findMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45
parse_lineMethod · 0.45
initializeMethod · 0.45
get_resource_idsMethod · 0.45
c_strMethod · 0.45
push_backMethod · 0.45

Tested by 1

send_requestFunction · 0.64