httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject [PATCH] 1.3: fix for Brian's CGI problem
Date Tue, 05 Aug 1997 06:40:48 GMT
Kudos go to Marc for doing the legwork of narrowing this down. 

I cleaned out some cruft from directory_walk which I should have cleaned
out when I applied Lou's multiple AccessName patch.  That patch wasn't
compatible with an optimization I had done ... so it was lost, ah well. I
added comments. 

Dean

Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.70
diff -u -r1.70 http_config.c
--- http_config.c	1997/08/05 06:02:40	1.70
+++ http_config.c	1997/08/05 06:34:04
@@ -884,7 +884,7 @@
 
 
 int parse_htaccess(void **result, request_rec *r, int override,
-		   char *d, const char *access_name)
+		   const char *d, const char *access_name)
 {
     FILE *f = NULL;
     cmd_parms parms;
@@ -907,17 +907,12 @@
     parms.pool = r->pool;
     parms.temp_pool = r->pool;
     parms.server = r->server;
-    parms.path = d;
+    parms.path = pstrdup (r->pool, d);
 
-    if (access_name) {
-	while (!f && access_name[0]) {
-	    char *w = getword_conf(r->pool, &access_name);
-	    filename = make_full_path(r->pool, d, w);
-	    f=pfopen(r->pool, filename, "r");
-	}
-    }
-    else {
-	filename = make_full_path(r->pool, d, 0);
+    /* loop through the access names and find the first one */
+    while (!f && access_name[0]) {
+	char *w = getword_conf(r->pool, &access_name);
+	filename = make_full_path(r->pool, d, w);
 	f=pfopen(r->pool, filename, "r");
     }
     if(f) {
@@ -941,7 +936,7 @@
 
 /* cache it */
     new = palloc(r->pool, sizeof(struct htaccess_result));
-    new->dir = pstrdup(r->pool, d);
+    new->dir = parms.path;
     new->override = override;
     new->htaccess = dc;
 /* add to head of list */
Index: http_config.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.h,v
retrieving revision 1.41
diff -u -r1.41 http_config.h
--- http_config.h	1997/07/28 18:22:43	1.41
+++ http_config.h	1997/08/05 06:34:05
@@ -302,7 +302,7 @@
 /* For http_core.c... (<Directory> command and virtual hosts) */
 
 int parse_htaccess(void **result, request_rec *r, int override,
-		   char *path, const char *access_name);
+		   const char *path, const char *access_name);
 const char *srm_command_loop (cmd_parms *parms, void *config);
 
 server_rec *init_virtual_host (pool *p, const char *hostname, server_rec *main_server);
Index: http_request.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_request.c,v
retrieving revision 1.68
diff -u -r1.68 http_request.c
--- http_request.c	1997/08/04 05:14:26	1.68
+++ http_request.c	1997/08/05 06:34:08
@@ -251,8 +251,7 @@
     core_dir_config **sec = (core_dir_config **)sec_array->elts;
     int num_sec = sec_array->nelts;
     char *test_filename = pstrdup (r->pool, r->filename);
-    char *test_dirname, *test_htaccess;
-
+    char *test_dirname;
     int num_dirs, res;
     int i, test_filename_len;
 
@@ -340,27 +339,27 @@
 
     if (S_ISDIR (r->finfo.st_mode)) ++num_dirs;
 
-    /* we need somewhere to scratch while building directory names and
-     * htaccess names
+    /* We will use test_dirname as scratch space while we build directory
+     * names during the walk.  Profiling shows directory_walk to be a busy
+     * function so we try to avoid allocating lots of extra memory here.
      */
     test_dirname = palloc (r->pool, test_filename_len+1);
-    test_htaccess = NULL;
     for (i = 1; i <= num_dirs; ++i) {
         core_dir_config *core_dir =
 	  (core_dir_config *)get_module_config(per_dir_defaults, &core_module);
 	int overrides_here;
-        void *htaccess_conf = NULL;
-	char *test_dirname_tail;
 	int j;
 
-	test_dirname_tail = make_dirstr_prefix (test_dirname, test_filename, i);
+	/* XXX: this could be made faster by only copying the next component
+	 * rather than copying the entire thing all over.
+	 */
+	make_dirstr_prefix (test_dirname, test_filename, i);
 
 	/* Do symlink checks first, because they are done with the
 	 * permissions appropriate to the *parent* directory...
 	 */
 	
-	if ((res = check_symlinks (test_dirname, core_dir->opts)))
-	{
+	if ((res = check_symlinks (test_dirname, core_dir->opts))) {
 	    log_reason("Symbolic link not allowed", test_dirname, r);
 	    return res;
 	}
@@ -416,16 +415,16 @@
 	 */
 	
 	if (overrides_here) {
+	    void *htaccess_conf = NULL;
+
   	    res = parse_htaccess (&htaccess_conf, r, overrides_here,
  				  test_dirname, sconf->access_name);
 	    if (res) return res;
+	    if (htaccess_conf)
+		per_dir_defaults =
+		    merge_per_dir_configs (r->pool, per_dir_defaults,
+					htaccess_conf);
 	}
-
-	if (htaccess_conf)
-	    per_dir_defaults =
-	        merge_per_dir_configs (r->pool, per_dir_defaults,
-				       htaccess_conf);
-	
     }
 
     r->per_dir_config = per_dir_defaults;


Mime
View raw message