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

Method find_template

src/proxy/http/HttpBodyFactory.cc:641–673  ·  view source on GitHub ↗

LOCKING: must be called with lock taken

Source from the content-addressed store, hash-verified

639
640// LOCKING: must be called with lock taken
641HttpBodyTemplate *
642HttpBodyFactory::find_template(const char *set, const char *type, HttpBodySet **body_set_return)
643{
644 Dbg(dbg_ctl_body_factory, "calling find_template(%s,%s)", set, type);
645
646 *body_set_return = nullptr;
647
648 if (table_of_sets == nullptr || !set || !type) {
649 return nullptr;
650 }
651 if (auto it = table_of_sets->find(set); it != table_of_sets->end()) {
652 HttpBodySet *body_set = static_cast<HttpBodySet *>(it->second);
653 if (body_set->table_of_pages == nullptr) {
654 return nullptr;
655 }
656
657 if (auto it_page = body_set->table_of_pages->find(type); it_page != body_set->table_of_pages->end()) {
658 HttpBodyTemplate *t = it_page->second;
659 if ((t == nullptr) || (!t->is_sane())) {
660 return nullptr;
661 }
662 *body_set_return = body_set;
663
664 Dbg(dbg_ctl_body_factory, "find_template(%s,%s) -> (file %s, length %" PRId64 ", lang '%s', charset '%s')", set, type,
665 t->template_pathname, t->byte_count, body_set->content_language, body_set->content_charset);
666
667 return t;
668 }
669 }
670 Dbg(dbg_ctl_body_factory, "find_template(%s,%s) -> NULL", set, type);
671
672 return nullptr;
673}
674
675// LOCKING: must be called with lock taken
676bool

Callers

nothing calls this directly

Calls 3

findMethod · 0.45
endMethod · 0.45
is_saneMethod · 0.45

Tested by

no test coverage detected