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

Function set_proxy_param

modules/proxy/mod_proxy.c:2711–2810  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2709}
2710
2711static const char *
2712 set_proxy_param(cmd_parms *cmd, void *dummy, const char *arg)
2713{
2714 server_rec *s = cmd->server;
2715 proxy_server_conf *conf =
2716 (proxy_server_conf *) ap_get_module_config(s->module_config, &proxy_module);
2717 char *name = NULL;
2718 char *word, *val;
2719 proxy_balancer *balancer = NULL;
2720 proxy_worker *worker = NULL;
2721 unsigned int worker_type = 0;
2722 int in_proxy_section = 0;
2723 /* XXX: Should this be NOT_IN_DIRECTORY|NOT_IN_FILES? */
2724 const char *err = ap_check_cmd_context(cmd, NOT_IN_HTACCESS);
2725 if (err)
2726 return err;
2727
2728 if (cmd->directive->parent &&
2729 strncasecmp(cmd->directive->parent->directive,
2730 "<Proxy", 6) == 0) {
2731 const char *pargs = cmd->directive->parent->args;
2732 /* Directive inside <Proxy section
2733 * Parent directive arg is the worker/balancer name.
2734 */
2735 name = ap_getword_conf(cmd->temp_pool, &pargs);
2736 if ((word = ap_strchr(name, '>')))
2737 *word = '\0';
2738 if (strncasecmp(cmd->directive->parent->directive + 6,
2739 "Match", 5) == 0) {
2740 worker_type = AP_PROXY_WORKER_IS_MATCH;
2741 }
2742 else {
2743 worker_type = AP_PROXY_WORKER_IS_PREFIX;
2744 }
2745 in_proxy_section = 1;
2746 }
2747 else {
2748 /* Standard set directive with worker/balancer
2749 * name as first param.
2750 */
2751 name = ap_getword_conf(cmd->temp_pool, &arg);
2752 }
2753
2754 if (ap_proxy_valid_balancer_name(name, 9)) {
2755 balancer = ap_proxy_get_balancer(cmd->pool, conf, name, 0);
2756 if (!balancer) {
2757 if (in_proxy_section) {
2758 err = ap_proxy_define_balancer(cmd->pool, &balancer, conf, name, "/", 0);
2759 if (err)
2760 return apr_pstrcat(cmd->temp_pool, "ProxySet ",
2761 err, NULL);
2762 }
2763 else
2764 return apr_pstrcat(cmd->temp_pool, "ProxySet can not find '",
2765 name, "' Balancer.", NULL);
2766 }
2767 }
2768 else {

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_strchrFunction · 0.85
ap_proxy_get_balancerFunction · 0.85
ap_proxy_define_balancerFunction · 0.85
ap_proxy_de_socketfyFunction · 0.85
ap_proxy_get_worker_exFunction · 0.85
set_worker_paramFunction · 0.85
set_balancer_paramFunction · 0.85

Tested by

no test coverage detected