Hi, the patch below solves the following situation.
The ProxyPassReverse directive is outside any <Location> block given as ProxyPassReverse /path http://... but inside a Location block without the /path specification: <Location /path> ProxyPassReverse http://... </Location> In the latter case the path is taken from $parms->path, that means the path of the Location block. Since $r->add_config([EMAIL PROTECTED]) is literally a <Location /> @lines </Location> ProxyPassReverse cannot be applied with $r->add_config for a path other than "/". The patch adds an optional 3rd parameter to $r->add_config that lets you pass in the path. I don't think ProxyPassReverse is the only directive that behaves this way. Torsten
diff -Naur -x '*~' mod_perl-2.0.2/docs/api/Apache2/RequestUtil.pod mod_perl-2.0.2.new/docs/api/Apache2/RequestUtil.pod
--- mod_perl-2.0.2/docs/api/Apache2/RequestUtil.pod 2005-10-21 02:05:00.000000000 +0200
+++ mod_perl-2.0.2.new/docs/api/Apache2/RequestUtil.pod 2006-01-06 21:28:52.257619564 +0100
@@ -108,6 +108,10 @@
$r->add_config($lines);
$r->add_config($lines, $override);
+ $r->add_config($lines, $override, $path);
+
+Configuration directives are processed as if given in a C<E<lt>LocationE<gt>>
+block.
=over 4
@@ -127,6 +131,14 @@
Default value is:
C<L<Apache2::Const::OR_AUTHCFG|docs::2.0::api::Apache2::Const/C_Apache2__Const__OR_AUTHCFG_>>
+=item opt arg3: C<$path> ( string )
+
+Set the C<L<Apache2::CmdParms object|docs::2.0::api::Apache2::CmdParms>> C<path> component.
+This is the path of the C<E<lt>LocationE<gt>> block. Some directives need this,
+for example C<ProxyPassReverse>.
+
+Default value is: C</>
+
=item ret: no return value
=item since: 2.0.00
diff -Naur -x '*~' mod_perl-2.0.2/src/modules/perl/modperl_config.c mod_perl-2.0.2.new/src/modules/perl/modperl_config.c
--- mod_perl-2.0.2/src/modules/perl/modperl_config.c 2005-10-21 02:04:26.000000000 +0200
+++ mod_perl-2.0.2.new/src/modules/perl/modperl_config.c 2006-01-06 20:20:48.928955761 +0100
@@ -578,16 +578,17 @@
const char *modperl_config_insert_request(pTHX_
request_rec *r,
SV *lines,
- int override)
+ int override,
+ char *path)
{
const char *errmsg;
ap_conf_vector_t *dconf = ap_create_per_dir_config(r->pool);
- /* The path argument of "/" is only required to be non-NULL
- and "/" is as good a default as anything else */
+ /* The path argument required to be non-NULL
+ and "/" is as good a default if nothing else given */
errmsg = modperl_config_insert(aTHX_
r->server, r->pool, r->pool,
- override, "/",
+ override, path ? apr_pstrdup( r->pool, path ) : "/",
dconf, lines);
if (errmsg) {
diff -Naur -x '*~' mod_perl-2.0.2/src/modules/perl/modperl_config.h mod_perl-2.0.2.new/src/modules/perl/modperl_config.h
--- mod_perl-2.0.2/src/modules/perl/modperl_config.h 2005-10-21 02:04:26.000000000 +0200
+++ mod_perl-2.0.2.new/src/modules/perl/modperl_config.h 2006-01-06 14:41:59.751611738 +0100
@@ -142,7 +142,8 @@
const char *modperl_config_insert_request(pTHX_
request_rec *r,
SV *lines,
- int override);
+ int override,
+ char *path);
int modperl_config_is_perl_option_enabled(pTHX_ request_rec *r,
server_rec *s, const char *name);
diff -Naur -x '*~' mod_perl-2.0.2/xs/Apache2/Access/Apache2__Access.h mod_perl-2.0.2.new/xs/Apache2/Access/Apache2__Access.h
--- mod_perl-2.0.2/xs/Apache2/Access/Apache2__Access.h 2005-10-21 02:04:29.000000000 +0200
+++ mod_perl-2.0.2.new/xs/Apache2/Access/Apache2__Access.h 2006-01-06 14:42:39.364339029 +0100
@@ -80,7 +80,8 @@
errmsg =
modperl_config_insert_request(aTHX_ r,
newRV_noinc((SV*)config),
- OR_AUTHCFG);
+ OR_AUTHCFG,
+ NULL);
if (errmsg) {
Perl_warn(aTHX_ "Can't change %s to '%s'\n", directive, val);
diff -Naur -x '*~' mod_perl-2.0.2/xs/Apache2/RequestUtil/Apache2__RequestUtil.h mod_perl-2.0.2.new/xs/Apache2/RequestUtil/Apache2__RequestUtil.h
--- mod_perl-2.0.2/xs/Apache2/RequestUtil/Apache2__RequestUtil.h 2005-10-21 02:04:29.000000000 +0200
+++ mod_perl-2.0.2.new/xs/Apache2/RequestUtil/Apache2__RequestUtil.h 2006-01-06 14:41:00.093552200 +0100
@@ -302,10 +302,10 @@
}
static MP_INLINE
-void mpxs_Apache2__RequestRec_add_config(pTHX_ request_rec *r, SV *lines, int override)
+void mpxs_Apache2__RequestRec_add_config(pTHX_ request_rec *r, SV *lines, int override, char *path)
{
const char *errmsg = modperl_config_insert_request(aTHX_ r, lines,
- override);
+ override, path);
if (errmsg) {
Perl_croak(aTHX_ "$r->add_config() has failed: %s", errmsg);
}
diff -Naur -x '*~' mod_perl-2.0.2/xs/maps/modperl_functions.map mod_perl-2.0.2.new/xs/maps/modperl_functions.map
--- mod_perl-2.0.2/xs/maps/modperl_functions.map 2005-10-21 02:04:27.000000000 +0200
+++ mod_perl-2.0.2.new/xs/maps/modperl_functions.map 2006-01-06 14:49:57.601992838 +0100
@@ -30,7 +30,7 @@
mpxs_Apache2__RequestRec_location
mpxs_Apache2__RequestRec_as_string
mpxs_Apache2__RequestRec_pnotes | | r, key=Nullsv, val=Nullsv
- mpxs_Apache2__RequestRec_add_config | | r, lines, override=OR_AUTHCFG
+ mpxs_Apache2__RequestRec_add_config | | r, lines, override=OR_AUTHCFG, path=NULL
mpxs_Apache2__RequestRec_document_root | | r, new_root=Nullsv
mpxs_Apache2__RequestRec_child_terminate
diff -Naur -x '*~' mod_perl-2.0.2/xs/tables/current/ModPerl/FunctionTable.pm mod_perl-2.0.2.new/xs/tables/current/ModPerl/FunctionTable.pm
--- mod_perl-2.0.2/xs/tables/current/ModPerl/FunctionTable.pm 2005-10-21 02:04:29.000000000 +0200
+++ mod_perl-2.0.2.new/xs/tables/current/ModPerl/FunctionTable.pm 2006-01-06 14:52:42.194073075 +0100
@@ -1417,6 +1417,10 @@
{
'type' => 'int',
'name' => 'override'
+ },
+ {
+ 'type' => 'char *',
+ 'name' => 'path'
}
]
},
@@ -6636,6 +6640,10 @@
{
'type' => 'int',
'name' => 'override'
+ },
+ {
+ 'type' => 'char *',
+ 'name' => 'path'
}
]
},
pgpWmbFTCF4TP.pgp
Description: PGP signature
