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

Function proxysection

modules/proxy/mod_proxy.c:2821–2969  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2819}
2820
2821static const char *proxysection(cmd_parms *cmd, void *mconfig, const char *arg)
2822{
2823 const char *errmsg;
2824 const char *endp = ap_strrchr_c(arg, '>');
2825 int old_overrides = cmd->override;
2826 char *old_path = cmd->path;
2827 proxy_dir_conf *conf;
2828 ap_conf_vector_t *new_dir_conf = ap_create_per_dir_config(cmd->pool);
2829 ap_regex_t *r = NULL;
2830 const command_rec *thiscmd = cmd->cmd;
2831 char *word, *val;
2832 proxy_balancer *balancer = NULL;
2833 proxy_worker *worker = NULL;
2834 unsigned int worker_type = AP_PROXY_WORKER_IS_PREFIX;
2835 const char *err = ap_check_cmd_context(cmd, NOT_IN_DIR_CONTEXT);
2836 proxy_server_conf *sconf =
2837 (proxy_server_conf *) ap_get_module_config(cmd->server->module_config, &proxy_module);
2838
2839 if (err != NULL) {
2840 return err;
2841 }
2842
2843 if (endp == NULL) {
2844 return apr_pstrcat(cmd->pool, cmd->cmd->name,
2845 "> directive missing closing '>'", NULL);
2846 }
2847
2848 arg = apr_pstrndup(cmd->pool, arg, endp-arg);
2849
2850 if (!arg) {
2851 if (thiscmd->cmd_data)
2852 return "<ProxyMatch > block must specify a path";
2853 else
2854 return "<Proxy > block must specify a path";
2855 }
2856
2857 cmd->path = ap_getword_conf(cmd->pool, &arg);
2858 cmd->override = OR_ALL|ACCESS_CONF|PROXY_CONF;
2859
2860 if (!strncasecmp(cmd->path, "proxy:", 6))
2861 cmd->path += 6;
2862
2863 /* XXX Ignore case? What if we proxy a case-insensitive server?!?
2864 * While we are at it, shouldn't we also canonicalize the entire
2865 * scheme? See proxy_fixup()
2866 */
2867 if (thiscmd->cmd_data) { /* <ProxyMatch> */
2868 r = ap_pregcomp(cmd->pool, cmd->path, AP_REG_EXTENDED);
2869 if (!r) {
2870 return "Regex could not be compiled";
2871 }
2872 worker_type = AP_PROXY_WORKER_IS_MATCH;
2873 }
2874
2875 /* initialize our config and fetch it */
2876 conf = ap_set_config_vectors(cmd->server, new_dir_conf, cmd->path,
2877 &proxy_module, cmd->pool);
2878

Callers

nothing calls this directly

Calls 15

ap_strrchr_cFunction · 0.85
ap_create_per_dir_configFunction · 0.85
ap_check_cmd_contextFunction · 0.85
ap_get_module_configFunction · 0.85
ap_getword_confFunction · 0.85
ap_pregcompFunction · 0.85
ap_set_config_vectorsFunction · 0.85
ap_walk_configFunction · 0.85
ap_regnameFunction · 0.85
ap_add_per_proxy_confFunction · 0.85
ap_strchr_cFunction · 0.85

Tested by

no test coverage detected