dgaudet 97/08/06 12:53:56
Modified: src CHANGES http_config.c http_config.h http_request.c
Log:
This probably fixes Brian's CGI problems. But at any rate it's necessary
even if it isn't the exact bug that's tickling Brian. My first directory_walk
optimization was corrupting the htaccess cache and the cmd->path passed
to modules via parse_htaccess().
Revision Changes Path
1.386 +3 -0 apache/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.385
retrieving revision 1.386
diff -u -r1.385 -r1.386
--- CHANGES 1997/08/05 10:49:39 1.385
+++ CHANGES 1997/08/06 19:53:48 1.386
@@ -1,4 +1,7 @@
Changes with Apache 1.3a2
+
+ *) Fix a bug introduced in 1.3a1 directory_walk regarding .htaccess files
+ and corrupted paths. [Dean Gaudet]
*) Enhanced and cleaned up the URL rewriting engine of mod_rewrite:
First the grouped parts of RewriteRule pattern matches (parenthesis!)
can
1.71 +7 -12 apache/src/http_config.c
Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- http_config.c 1997/08/05 06:02:40 1.70
+++ http_config.c 1997/08/06 19:53:50 1.71
@@ -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 */
1.42 +1 -1 apache/src/http_config.h
Index: http_config.h
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.h,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- http_config.h 1997/07/28 18:22:43 1.41
+++ http_config.h 1997/08/06 19:53:50 1.42
@@ -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);
1.69 +15 -16 apache/src/http_request.c
Index: http_request.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_request.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- http_request.c 1997/08/04 05:14:26 1.68
+++ http_request.c 1997/08/06 19:53:51 1.69
@@ -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;