akosut 96/04/09 16:06:04
Modified: src http_request.c Log: Change the access file parsing so that <Location> sections are parsed after <Directory> sections. This lets the latter override the former, which in most cases is the desired behavior. Revision Changes Path 1.6 +56 -41 apache/src/http_request.c Index: http_request.c =================================================================== RCS file: /export/home/cvs/apache/src/http_request.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C3 -r1.5 -r1.6 *** http_request.c 1996/04/06 23:38:26 1.5 --- http_request.c 1996/04/09 23:06:03 1.6 *************** *** 192,247 **** core_server_config *sconf = get_module_config (r->server->module_config, &core_module); array_header *sec_array = copy_array (r->pool, sconf->sec); - array_header *url_array = copy_array (r->pool, sconf->sec_url); void *per_dir_defaults = r->server->lookup_defaults; core_dir_config **sec = (core_dir_config **)sec_array->elts; int num_sec = sec_array->nelts; char *test_filename = pstrdup (r->pool, r->filename); - core_dir_config **url = (core_dir_config **)url_array->elts; - int num_url = url_array->nelts; - char *test_location = pstrdup (r->pool, r->uri); - int num_dirs, res; int i; - /* First, go through the location entries, and check for matches. */ - - if (num_url) { - void *this_conf, *entry_config; - core_dir_config *entry_core; - char *entry_url; - int j; - - /* - * we apply the directive sections in some order; should really try them - * with the most general first. - */ - for (j = 0; j < num_url; ++j) { - - entry_config = url[j]; - if (!entry_config) continue; - - entry_core =(core_dir_config *) - get_module_config(entry_config, &core_module); - entry_url = entry_core->d; - - this_conf = NULL; - if (is_matchexp(entry_url)) { - if (!strcmp_match(test_location, entry_url)) - this_conf = entry_config; - } - else if (!strncmp (test_location, entry_url, strlen(entry_url))) - this_conf = entry_config; - - if (this_conf) - per_dir_defaults = merge_per_dir_configs (r->pool, - per_dir_defaults, this_conf); - } - - } - /* Are we dealing with a file? If not, we can (hopefuly) safely assume * we have a handler that doesn't require one, but for safety's sake, * and so we have something find_types() can get something out of, --- 192,206 ---- *************** *** 391,396 **** --- 350,406 ---- */ } + int location_walk (request_rec *r) + { + core_server_config *sconf = get_module_config (r->server->module_config, + &core_module); + array_header *url_array = copy_array (r->pool, sconf->sec_url); + void *per_dir_defaults = r->per_dir_config; + + core_dir_config **url = (core_dir_config **)url_array->elts; + int num_url = url_array->nelts; + char *test_location = pstrdup (r->pool, r->uri); + + /* Go through the location entries, and check for matches. */ + + if (num_url) { + void *this_conf, *entry_config; + core_dir_config *entry_core; + char *entry_url; + int j; + + /* + * we apply the directive sections in some order; should really try them + * with the most general first. + */ + for (j = 0; j < num_url; ++j) { + + entry_config = url[j]; + if (!entry_config) continue; + + entry_core =(core_dir_config *) + get_module_config(entry_config, &core_module); + entry_url = entry_core->d; + + this_conf = NULL; + if (is_matchexp(entry_url)) { + if (!strcmp_match(test_location, entry_url)) + this_conf = entry_config; + } + else if (!strncmp (test_location, entry_url, strlen(entry_url))) + this_conf = entry_config; + + if (this_conf) + per_dir_defaults = merge_per_dir_configs (r->pool, + per_dir_defaults, this_conf); + } + + r->per_dir_config = per_dir_defaults; + } + + return OK; + } + /***************************************************************** * * The sub_request mechanism. *************** *** 685,690 **** --- 695,705 ---- } if ((access_status = directory_walk (r))) { + die (access_status, r); + return; + } + + if ((access_status = location_walk (r))) { die (access_status, r); return; }