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

Method duplicate_entry

src/proxy/hdrs/XPACK.cc:376–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

374}
375
376const XpackLookupResult
377XpackDynamicTable::duplicate_entry(uint32_t current_index)
378{
379 const char *name = nullptr;
380 size_t name_len = 0;
381 const char *value = nullptr;
382 size_t value_len = 0;
383 char *duped_name;
384 char *duped_value;
385
386 XpackLookupResult result = this->lookup(current_index, &name, &name_len, &value, &value_len);
387 if (result.match_type != XpackLookupResult::MatchType::EXACT) {
388 return result;
389 }
390
391 // We need to dup name and value to avoid memcpy-param-overlap
392 duped_name = ats_strndup(name, name_len);
393 duped_value = ats_strndup(value, value_len);
394 result = this->insert_entry(duped_name, name_len, duped_value, value_len);
395 ats_free(duped_name);
396 ats_free(duped_value);
397
398 return result;
399}
400
401bool
402XpackDynamicTable::should_duplicate(uint32_t /* index ATS_UNUSED */)

Callers 2

_encode_headerMethod · 0.80

Calls 3

lookupMethod · 0.95
insert_entryMethod · 0.95
ats_freeFunction · 0.85

Tested by

no test coverage detected