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

Function add_name_vhost_config

server/vhost.c:539–570  ·  view source on GitHub ↗

* When a second or later virtual host maps to the same IP chain, * add the relevant server names to the chain. Special care is taken * to avoid adding ic->names until we're sure there are multiple VH'es. */

Source from the content-addressed store, hash-verified

537 * to avoid adding ic->names until we're sure there are multiple VH'es.
538 */
539static void add_name_vhost_config(apr_pool_t *p, server_rec *main_s,
540 server_rec *s, server_addr_rec *sar,
541 ipaddr_chain *ic)
542{
543
544 name_chain *nc = new_name_chain(p, s, sar);
545 nc->next = ic->names;
546
547 /* iterating backwards, so each one we see becomes the current default server */
548 ic->server = s;
549
550 if (ic->names == NULL) {
551 if (ic->initialnames == NULL) {
552 /* first pass, set these names aside in case we see another VH.
553 * Until then, this looks like an IP-based VH to runtime.
554 */
555 ic->initialnames = nc;
556 }
557 else {
558 /* second pass through this chain -- this really is an NVH, and we
559 * have two sets of names to link in.
560 */
561 nc->next = ic->initialnames;
562 ic->names = nc;
563 ic->initialnames = NULL;
564 }
565 }
566 else {
567 /* 3rd or more -- just keep stacking the names */
568 ic->names = nc;
569 }
570}
571
572/* compile the tables and such we need to do the run-time vhost lookups */
573AP_DECLARE(void) ap_fini_vhost_config(apr_pool_t *p, server_rec *main_s)

Callers 1

ap_fini_vhost_configFunction · 0.85

Calls 1

new_name_chainFunction · 0.85

Tested by

no test coverage detected