| 1057 | } |
| 1058 | |
| 1059 | static int proxy_walk(request_rec *r) |
| 1060 | { |
| 1061 | proxy_server_conf *sconf = ap_get_module_config(r->server->module_config, |
| 1062 | &proxy_module); |
| 1063 | ap_conf_vector_t *per_dir_defaults = r->per_dir_config; |
| 1064 | ap_conf_vector_t **sec_proxy = (ap_conf_vector_t **) sconf->sec_proxy->elts; |
| 1065 | ap_conf_vector_t *entry_config; |
| 1066 | proxy_dir_conf *entry_proxy; |
| 1067 | int num_sec = sconf->sec_proxy->nelts; |
| 1068 | /* XXX: shouldn't we use URI here? Canonicalize it first? |
| 1069 | * Pass over "proxy:" prefix |
| 1070 | */ |
| 1071 | const char *proxyname = r->filename + 6; |
| 1072 | int j; |
| 1073 | apr_pool_t *rxpool = NULL; |
| 1074 | |
| 1075 | for (j = 0; j < num_sec; ++j) |
| 1076 | { |
| 1077 | int nmatch = 0; |
| 1078 | int i; |
| 1079 | ap_regmatch_t *pmatch = NULL; |
| 1080 | |
| 1081 | entry_config = sec_proxy[j]; |
| 1082 | entry_proxy = ap_get_module_config(entry_config, &proxy_module); |
| 1083 | |
| 1084 | if (entry_proxy->r) { |
| 1085 | |
| 1086 | if (entry_proxy->refs && entry_proxy->refs->nelts) { |
| 1087 | if (!rxpool) { |
| 1088 | apr_pool_create(&rxpool, r->pool); |
| 1089 | apr_pool_tag(rxpool, "proxy_rxpool"); |
| 1090 | } |
| 1091 | nmatch = entry_proxy->refs->nelts; |
| 1092 | pmatch = apr_palloc(rxpool, nmatch*sizeof(ap_regmatch_t)); |
| 1093 | } |
| 1094 | |
| 1095 | if (ap_regexec(entry_proxy->r, proxyname, nmatch, pmatch, 0)) { |
| 1096 | continue; |
| 1097 | } |
| 1098 | |
| 1099 | for (i = 0; i < nmatch; i++) { |
| 1100 | if (pmatch[i].rm_so >= 0 && pmatch[i].rm_eo >= 0 && |
| 1101 | ((const char **)entry_proxy->refs->elts)[i]) { |
| 1102 | apr_table_setn(r->subprocess_env, |
| 1103 | ((const char **)entry_proxy->refs->elts)[i], |
| 1104 | apr_pstrndup(r->pool, |
| 1105 | proxyname + pmatch[i].rm_so, |
| 1106 | pmatch[i].rm_eo - pmatch[i].rm_so)); |
| 1107 | } |
| 1108 | } |
| 1109 | } |
| 1110 | |
| 1111 | else if ( |
| 1112 | /* XXX: What about case insensitive matching ??? |
| 1113 | * Compare regex, fnmatch or string as appropriate |
| 1114 | * If the entry doesn't relate, then continue |
| 1115 | */ |
| 1116 | entry_proxy->p_is_fnmatch ? apr_fnmatch(entry_proxy->p, |
no test coverage detected