| 1029 | } |
| 1030 | |
| 1031 | HttpBodyTemplate * |
| 1032 | HttpBodySet::get_template_by_name(const char *name) |
| 1033 | { |
| 1034 | Dbg(dbg_ctl_body_factory, " calling get_template_by_name(%s)", name); |
| 1035 | |
| 1036 | if (table_of_pages == nullptr) { |
| 1037 | return nullptr; |
| 1038 | } |
| 1039 | |
| 1040 | if (auto it = table_of_pages->find(name); it != table_of_pages->end()) { |
| 1041 | HttpBodyTemplate *t = it->second; |
| 1042 | if ((t == nullptr) || (!t->is_sane())) { |
| 1043 | return nullptr; |
| 1044 | } |
| 1045 | Dbg(dbg_ctl_body_factory, " get_template_by_name(%s) -> (file %s, length %" PRId64 ")", name, t->template_pathname, |
| 1046 | t->byte_count); |
| 1047 | return t; |
| 1048 | } |
| 1049 | Dbg(dbg_ctl_body_factory, " get_template_by_name(%s) -> NULL", name); |
| 1050 | return nullptr; |
| 1051 | } |
| 1052 | |
| 1053 | void |
| 1054 | HttpBodySet::set_template_by_name(const char *name, HttpBodyTemplate *t) |