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

Function add_member

modules/proxy/mod_proxy.c:2607–2709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2605}
2606
2607static const char *add_member(cmd_parms *cmd, void *dummy, const char *arg)
2608{
2609 server_rec *s = cmd->server;
2610 proxy_server_conf *conf =
2611 ap_get_module_config(s->module_config, &proxy_module);
2612 proxy_balancer *balancer;
2613 proxy_worker *worker;
2614 char *path = cmd->path;
2615 char *name = NULL;
2616 const char *real;
2617 char *word;
2618 apr_table_t *params = apr_table_make(cmd->pool, 5);
2619 const apr_array_header_t *arr;
2620 const apr_table_entry_t *elts;
2621 int reuse = 0;
2622 int i;
2623 /* XXX: Should this be NOT_IN_DIRECTORY|NOT_IN_FILES? */
2624 const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
2625 if (err)
2626 return err;
2627
2628 if (cmd->path)
2629 path = apr_pstrdup(cmd->pool, cmd->path);
2630
2631 while (*arg) {
2632 char *val;
2633 word = ap_getword_conf(cmd->pool, &arg);
2634 val = strchr(word, '=');
2635
2636 if (!val) {
2637 if (!path)
2638 path = word;
2639 else if (!name)
2640 name = word;
2641 else {
2642 if (cmd->path)
2643 return "BalancerMember can not have a balancer name when defined in a location";
2644 else
2645 return "Invalid BalancerMember parameter. Parameter must "
2646 "be in the form 'key=value'";
2647 }
2648 } else {
2649 *val++ = '\0';
2650 apr_table_setn(params, word, val);
2651 }
2652 }
2653 if (!path)
2654 return "BalancerMember must define balancer name when outside <Proxy > section";
2655 if (!name)
2656 return "BalancerMember must define remote proxy server";
2657 if (!(real = ap_proxy_de_socketfy(cmd->temp_pool, name))) {
2658 return "BalancerMember uses an invalid \"unix:\" URL";
2659 }
2660
2661 ap_str_tolower(path); /* lowercase scheme://hostname */
2662
2663 /* Try to find the balancer */
2664 balancer = ap_proxy_get_balancer(cmd->temp_pool, conf, path, 0);

Callers

nothing calls this directly

Calls 12

ap_get_module_configFunction · 0.85
ap_check_cmd_contextFunction · 0.85
ap_getword_confFunction · 0.85
ap_proxy_de_socketfyFunction · 0.85
ap_str_tolowerFunction · 0.85
ap_proxy_get_balancerFunction · 0.85
ap_proxy_define_balancerFunction · 0.85
ap_proxy_get_workerFunction · 0.85
ap_proxy_define_workerFunction · 0.85
ap_proxy_worker_nameFunction · 0.85
set_worker_paramFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected