MCPcopy Create free account
hub / github.com/apache/httpd / ap_build_config_sub

Function ap_build_config_sub

server/config.c:1110–1246  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1108 ap_directive_t *parent);
1109
1110static const char *ap_build_config_sub(apr_pool_t *p, apr_pool_t *temp_pool,
1111 const char *l, cmd_parms *parms,
1112 ap_directive_t **current,
1113 ap_directive_t **curr_parent,
1114 ap_directive_t **conftree)
1115{
1116 const char *retval = NULL;
1117 const char *args;
1118 char *cmd_name;
1119 ap_directive_t *newdir;
1120 const command_rec *cmd;
1121 ap_mod_list *ml;
1122 char *lname;
1123
1124 if (*l == '#' || *l == '\0')
1125 return NULL;
1126
1127#if RESOLVE_ENV_PER_TOKEN
1128 args = l;
1129#else
1130 args = ap_resolve_env(temp_pool, l);
1131#endif
1132
1133 /* The first word is the name of a directive. We can safely use the
1134 * 'temp_pool' for it. If it matches the name of a known directive, we
1135 * can reference the string within the module if needed. Otherwise, we
1136 * can still make a copy in the 'p' pool. */
1137 cmd_name = ap_getword_conf(temp_pool, &args);
1138 if (*cmd_name == '\0') {
1139 /* Note: this branch should not occur. An empty line should have
1140 * triggered the exit further above.
1141 */
1142 return NULL;
1143 }
1144
1145 if (cmd_name[1] != '/') {
1146 char *lastc = cmd_name + strlen(cmd_name) - 1;
1147 if (*lastc == '>') {
1148 *lastc = '\0' ;
1149 }
1150 if (cmd_name[0] == '<' && *args == '\0') {
1151 args = ">";
1152 }
1153 }
1154
1155 newdir = apr_pcalloc(p, sizeof(ap_directive_t));
1156 newdir->filename = parms->config_file->name;
1157 newdir->line_num = parms->config_file->line_number;
1158 newdir->args = apr_pstrdup(p, args);
1159
1160 lname = apr_pstrdup(temp_pool, cmd_name);
1161 ap_str_tolower(lname);
1162 ml = apr_hash_get(ap_config_hash, lname, APR_HASH_KEY_STRING);
1163
1164 if (ml && (cmd = ml->cmd) != NULL) {
1165 newdir->directive = cmd->name;
1166 if (cmd->req_override & EXEC_ON_READ) {
1167 ap_directive_t *sub_tree = NULL;

Callers 2

ap_build_cont_configFunction · 0.85
ap_build_configFunction · 0.85

Calls 6

ap_resolve_envFunction · 0.85
ap_getword_confFunction · 0.85
ap_str_tolowerFunction · 0.85
execute_nowFunction · 0.85
ap_add_nodeFunction · 0.85
ap_cstr_casecmpFunction · 0.85

Tested by

no test coverage detected