You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by dg...@hyperreal.org on 1998/03/06 09:26:19 UTC

cvs commit: apache-1.3/src/main http_request.c

dgaudet     98/03/06 00:26:19

  Modified:    src/main http_request.c
  Log:
  No functional difference, other than to short-circuit earlier if there are
  no Location sections.  I wanted to do this before I made another change
  which will have functional difference.
  
  Revision  Changes    Path
  1.110     +43 -41    apache-1.3/src/main/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_request.c,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- http_request.c	1998/03/02 06:51:10	1.109
  +++ http_request.c	1998/03/06 08:26:18	1.110
  @@ -499,58 +499,60 @@
       void *per_dir_defaults = r->per_dir_config;
       void **url = (void **) sconf->sec_url->elts;
       int len, num_url = sconf->sec_url->nelts;
  -    char *test_location = pstrdup(r->pool, r->uri);
  +    char *test_location;
  +    void *this_conf, *entry_config;
  +    core_dir_config *entry_core;
  +    char *entry_url;
  +    int j;
  +
  +    if (!num_url) {
  +	return OK;
  +    }
   
       /*
        * Collapse multiple slashes, if it's a path URL (we don't want to do
        * anything to <Location http://...> or such).
        */
  +    test_location = pstrdup(r->pool, r->uri);
       if (test_location[0] == '/')
           no2slash(test_location);
   
       /* 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];
  -
  -            entry_core = (core_dir_config *)
  -                get_module_config(entry_config, &core_module);
  -            entry_url = entry_core->d;
  -
  -            len = strlen(entry_url);
  -
  -            this_conf = NULL;
  -
  -            if (entry_core->r) {
  -                if (!regexec(entry_core->r, test_location, 0, NULL, 0))
  -                    this_conf = entry_config;
  -            }
  -            else if (entry_core->d_is_fnmatch) {
  -                if (!fnmatch(entry_url, test_location, FNM_PATHNAME)) {
  -                    this_conf = entry_config;
  -                }
  -            }
  -            else if (!strncmp(test_location, entry_url, len) &&
  -                     (entry_url[len - 1] == '/' ||
  -                   test_location[len] == '/' || test_location[len] == '\0'))
  -                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;
  +    /* 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];
  +
  +	entry_core = (core_dir_config *)
  +	    get_module_config(entry_config, &core_module);
  +	entry_url = entry_core->d;
  +
  +	len = strlen(entry_url);
  +
  +	this_conf = NULL;
  +
  +	if (entry_core->r) {
  +	    if (!regexec(entry_core->r, test_location, 0, NULL, 0))
  +		this_conf = entry_config;
  +	}
  +	else if (entry_core->d_is_fnmatch) {
  +	    if (!fnmatch(entry_url, test_location, FNM_PATHNAME)) {
  +		this_conf = entry_config;
  +	    }
  +	}
  +	else if (!strncmp(test_location, entry_url, len) &&
  +		    (entry_url[len - 1] == '/' ||
  +		test_location[len] == '/' || test_location[len] == '\0'))
  +	    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;
   }