On Wed 01 Apr 2009, Dan Poirier wrote:
> Lars Eilebrecht <[email protected]> writes:
> > Torsten Foertsch wrote:
> >
> > [mod_include DATE_LOCAL bug]
> >
> >> Is this a known bug?
> >
> > It's probably this one:
> > https://issues.apache.org/bugzilla/show_bug.cgi?id=39369
>
> I think that's right. It's a test for Joe's fix for 39369, that has
> only been applied to trunk. It would be nice to backport that fix so
> the stable release doesn't fail tests (or else do something with that
> test).
Here is a patch that works for 2.2.11. The mod_rerwite patch cures the
failure in t/modules/rewrite.t:
https://issues.apache.org/bugzilla/show_bug.cgi?id=46428
in 2.2.11.
The mod_info problem in my original mail was caused by my local setup
and is rather a Apache::Test problem (if at all). I have 2 modperl
versions installed, mod_perl-debug.so and mod_perl.so. That has
confused the test.
Should I attach these patches to the problem reports in bugzilla or is
that useless because they wont be backported officially?
Torsten
--
Need professional mod_perl support?
Just hire me: [email protected]
--- modules/mappers/mod_rewrite.c.xx 2009-04-01 11:28:01.000000000 +0200
+++ modules/mappers/mod_rewrite.c 2009-04-01 11:35:28.000000000 +0200
@@ -3869,7 +3869,20 @@
* ourself).
*/
if (p->flags & RULEFLAG_PROXY) {
- /* PR#39746: Escaping things here gets repeated in mod_proxy */
+ /* For rules evaluated in server context, the mod_proxy fixup
+ * hook can be relied upon to escape the URI as and when
+ * necessary, since it occurs later. If in directory context,
+ * the ordering of the fixup hooks is forced such that
+ * mod_proxy comes first, so the URI must be escaped here
+ * instead. See PR 39746, 46428, and other headaches. */
+ if (ctx->perdir && (p->flags & RULEFLAG_NOESCAPE) == 0) {
+ char *old_filename = r->filename;
+
+ r->filename = ap_escape_uri(r->pool, r->filename);
+ rewritelog((r, 2, ctx->perdir, "escaped URI in per-dir context "
+ "for proxy, %s -> %s", old_filename, r->filename));
+ }
+
fully_qualify_uri(r);
rewritelog((r, 2, ctx->perdir, "forcing proxy-throughput with %s",
--- modules/filters/mod_include.c.orig 2008-03-17 15:32:47.000000000 +0100
+++ modules/filters/mod_include.c 2009-04-01 14:45:41.000000000 +0200
@@ -580,7 +580,7 @@
*p = '\0';
}
-static void add_include_vars(request_rec *r, const char *timefmt)
+static void add_include_vars(request_rec *r)
{
apr_table_t *e = r->subprocess_env;
char *t;
@@ -608,26 +608,17 @@
}
}
-static const char *add_include_vars_lazy(request_rec *r, const char *var)
+static const char *add_include_vars_lazy(request_rec *r, const char *var, const char *timefmt)
{
char *val;
if (!strcasecmp(var, "DATE_LOCAL")) {
- include_dir_config *conf =
- (include_dir_config *)ap_get_module_config(r->per_dir_config,
- &include_module);
- val = ap_ht_time(r->pool, r->request_time, conf->default_time_fmt, 0);
+ val = ap_ht_time(r->pool, r->request_time, timefmt, 0);
}
else if (!strcasecmp(var, "DATE_GMT")) {
- include_dir_config *conf =
- (include_dir_config *)ap_get_module_config(r->per_dir_config,
- &include_module);
- val = ap_ht_time(r->pool, r->request_time, conf->default_time_fmt, 1);
+ val = ap_ht_time(r->pool, r->request_time, timefmt, 1);
}
else if (!strcasecmp(var, "LAST_MODIFIED")) {
- include_dir_config *conf =
- (include_dir_config *)ap_get_module_config(r->per_dir_config,
- &include_module);
- val = ap_ht_time(r->pool, r->finfo.mtime, conf->default_time_fmt, 0);
+ val = ap_ht_time(r->pool, r->finfo.mtime, timefmt, 0);
}
else if (!strcasecmp(var, "USER_NAME")) {
if (apr_uid_name_get(&val, r->finfo.user, r->pool) != APR_SUCCESS) {
@@ -684,7 +675,7 @@
val = apr_table_get(r->subprocess_env, var);
if (val == LAZY_VALUE) {
- val = add_include_vars_lazy(r, var);
+ val = add_include_vars_lazy(r, var, ctx->time_str);
}
}
@@ -2423,7 +2414,7 @@
/* get value */
val_text = elts[i].val;
if (val_text == LAZY_VALUE) {
- val_text = add_include_vars_lazy(r, elts[i].key);
+ val_text = add_include_vars_lazy(r, elts[i].key, ctx->time_str);
}
val_text = ap_escape_html(ctx->dpool, elts[i].val);
v_len = strlen(val_text);
@@ -3608,7 +3599,7 @@
* environment */
ap_add_common_vars(r);
ap_add_cgi_vars(r);
- add_include_vars(r, conf->default_time_fmt);
+ add_include_vars(r);
}
/* Always unset the content-length. There is no way to know if
* the content will be modified at some point by send_parsed_content.