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

Function ap_build_config

server/config.c:1387–1463  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1385}
1386
1387AP_DECLARE(const char *) ap_build_config(cmd_parms *parms,
1388 apr_pool_t *p, apr_pool_t *temp_pool,
1389 ap_directive_t **conftree)
1390{
1391 ap_directive_t *current = *conftree;
1392 ap_directive_t *curr_parent = NULL;
1393 const char *errmsg;
1394 ap_directive_t **last_ptr = NULL;
1395 apr_status_t rc;
1396 struct ap_varbuf vb;
1397 apr_size_t max_len = VARBUF_MAX_LEN;
1398 if (p == temp_pool)
1399 max_len = HUGE_STRING_LEN; /* lower limit for .htaccess */
1400
1401 ap_varbuf_init(temp_pool, &vb, VARBUF_INIT_LEN);
1402
1403 if (current != NULL) {
1404 /* If we have to traverse the whole tree again for every included
1405 * config file, the required time grows as O(n^2) with the number of
1406 * files. This can be a significant delay for large configurations.
1407 * Therefore we cache a pointer to the last node.
1408 */
1409 last_ptr = &(current->last);
1410
1411 if (last_ptr && *last_ptr) {
1412 current = *last_ptr;
1413 }
1414
1415 while (current->next) {
1416 current = current->next;
1417 }
1418
1419 if (last_ptr) {
1420 /* update cached pointer to last node */
1421 *last_ptr = current;
1422 }
1423 }
1424
1425 while ((rc = ap_varbuf_cfg_getline(&vb, parms->config_file, max_len))
1426 == APR_SUCCESS) {
1427 errmsg = ap_build_config_sub(p, temp_pool, vb.buf, parms,
1428 &current, &curr_parent, conftree);
1429 if (errmsg != NULL)
1430 return errmsg;
1431
1432 if (*conftree == NULL && curr_parent != NULL) {
1433 *conftree = curr_parent;
1434 }
1435
1436 if (*conftree == NULL && current != NULL) {
1437 *conftree = current;
1438 }
1439 }
1440 ap_varbuf_free(&vb);
1441 if (rc != APR_EOF && rc != APR_SUCCESS)
1442 return ap_pcfg_strerror(temp_pool, parms->config_file, rc);
1443
1444 if (curr_parent != NULL) {

Callers 4

process_command_configFunction · 0.85
ap_parse_htaccessFunction · 0.85
http_config.hFile · 0.85

Calls 5

ap_varbuf_initFunction · 0.85
ap_varbuf_cfg_getlineFunction · 0.85
ap_build_config_subFunction · 0.85
ap_varbuf_freeFunction · 0.85
ap_pcfg_strerrorFunction · 0.85

Tested by

no test coverage detected