rbb 02/05/29 17:02:59
Modified: modules/mappers mod_rewrite.c mod_rewrite.h
Log:
Tokenize the arguments for rewrite programs during config parsing, and
just use that information later. I was having a problem with prg
directives with arguments failing the configuration. The problem was
a call to stat, which was being passed the program name and the arguments.
Obviously, the arguments were messing up the call to stat. This gets the
test suite working for me again.
Revision Changes Path
1.119 +6 -7 httpd-2.0/modules/mappers/mod_rewrite.c
Index: mod_rewrite.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -r1.118 -r1.119
--- mod_rewrite.c 29 May 2002 04:38:59 -0000 1.118
+++ mod_rewrite.c 30 May 2002 00:02:59 -0000 1.119
@@ -455,8 +455,9 @@
}
else if (strncmp(a2, "prg:", 4) == 0) {
newmap->type = MAPTYPE_PRG;
- newmap->datafile = a2+4;
- newmap->checkfile = NULL;
+ apr_tokenize_to_argv(a2 + 4, &newmap->argv, cmd->pool);
+ newmap->checkfile = newmap->argv[0];
+
}
else if (strncmp(a2, "int:", 4) == 0) {
newmap->type = MAPTYPE_INT;
@@ -3404,7 +3405,7 @@
}
fpin = NULL;
fpout = NULL;
- rc = rewritemap_program_child(p, map->datafile,
+ rc = rewritemap_program_child(p, map->argv[0], map->argv,
&fpout, &fpin, &fperr);
if (rc != APR_SUCCESS || fpin == NULL || fpout == NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR, rc, s,
@@ -3420,7 +3421,8 @@
}
/* child process code */
-static apr_status_t rewritemap_program_child(apr_pool_t *p, const char *progname,
+static apr_status_t rewritemap_program_child(apr_pool_t *p,
+ const char *progname, char **argv,
apr_file_t **fpout, apr_file_t **fpin,
apr_file_t **fperr)
{
@@ -3428,9 +3430,6 @@
apr_procattr_t *procattr;
apr_proc_t *procnew;
apr_finfo_t st;
- char **argv;
-
- rc = apr_tokenize_to_argv(progname, &argv, p);
if (((rc = apr_stat(&st, argv[0], APR_FINFO_MIN, p)) != APR_SUCCESS) ||
((rc = apr_procattr_create(&procattr, p)) != APR_SUCCESS) ||
1.34 +3 -1 httpd-2.0/modules/mappers/mod_rewrite.h
Index: mod_rewrite.h
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- mod_rewrite.h 29 May 2002 04:38:59 -0000 1.33
+++ mod_rewrite.h 30 May 2002 00:02:59 -0000 1.34
@@ -253,6 +253,7 @@
apr_file_t *fperr; /* err file pointer for program maps */
char *(*func)(request_rec *, /* function pointer for internal maps */
char *);
+ char **argv;
} rewritemap_entry;
typedef struct {
@@ -456,7 +457,8 @@
/* program map support */
static apr_status_t run_rewritemap_programs(server_rec *s, apr_pool_t *p);
-static apr_status_t rewritemap_program_child(apr_pool_t *p, const char *progname,
+static apr_status_t rewritemap_program_child(apr_pool_t *p,
+ const char *progname, char **argv,
apr_file_t **fpout, apr_file_t **fpin,
apr_file_t **fperr);
|