You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl-cvs@perl.apache.org by st...@apache.org on 2004/11/24 22:18:09 UTC
svn commit: r106472 - /perl/modperl/trunk/Changes /perl/modperl/trunk/src/modules/perl/modperl_filter.c /perl/modperl/trunk/t/conf/extra.conf.in /perl/modperl/trunk/t/filter/out_apache.t
Author: stas
Date: Wed Nov 24 13:18:08 2004
New Revision: 106472
URL: http://svn.apache.org/viewcvs?view=rev&rev=106472
Log:
in case a native apache response filter is configured outside the
<Location> block with PerlSet*Filter directive, make sure that
mod_perl doesn't try to add it as connection filter (previously was
logging an error like: [error] a content filter was added without a
request: includes)
Added:
perl/modperl/trunk/t/filter/out_apache.t
Modified:
perl/modperl/trunk/Changes
perl/modperl/trunk/src/modules/perl/modperl_filter.c
perl/modperl/trunk/t/conf/extra.conf.in
Modified: perl/modperl/trunk/Changes
Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=106472&p1=perl/modperl/trunk/Changes&r1=106471&p2=perl/modperl/trunk/Changes&r2=106472
==============================================================================
--- perl/modperl/trunk/Changes (original)
+++ perl/modperl/trunk/Changes Wed Nov 24 13:18:08 2004
@@ -12,6 +12,12 @@
=item 1.99_18-dev
+in case a native apache response filter is configured outside the
+<Location> block with PerlSet*Filter directive, make sure that
+mod_perl doesn't try to add it as connection filter (previously was
+logging an error like: [error] a content filter was added without a
+request: includes) [Stas]
+
replace the slow implementation of anon handlers using B::Deparse,
with per-interpreter cache of compiled CODE refs (sort of emulating
named subroutines for anonymous handlers) [Stas].
Modified: perl/modperl/trunk/src/modules/perl/modperl_filter.c
Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_filter.c?view=diff&rev=106472&p1=perl/modperl/trunk/src/modules/perl/modperl_filter.c&r1=106471&p2=perl/modperl/trunk/src/modules/perl/modperl_filter.c&r2=106472
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_filter.c (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_filter.c Wed Nov 24 13:18:08 2004
@@ -950,10 +950,28 @@
/* process non-mod_perl filter handlers */
if ((handlers[i]->attrs & MP_FILTER_HTTPD_HANDLER)) {
+
+ /* non-mp2 filters below PROTOCOL level can't be added
+ * at the connection level, so we need to go through
+ * the pain of figuring out the type of the filter */
+ ap_filter_rec_t *frec;
+ char *normalized_name = apr_pstrdup(c->pool,
+ handlers[i]->name);
+ ap_str_tolower(normalized_name);
+ frec = idx == MP_INPUT_FILTER_HANDLER
+ ? ap_get_input_filter_handle(normalized_name)
+ : ap_get_output_filter_handle(normalized_name);
+ if (frec && frec->ftype < AP_FTYPE_PROTOCOL) {
+ MP_TRACE_f(MP_FUNC, "a non-mod_perl %s handler %s "
+ "skipped (not a connection filter)",
+ type, handlers[i]->name);
+ continue;
+ }
+
addfunc(handlers[i]->name, NULL, NULL, c);
MP_TRACE_f(MP_FUNC,
- "a non-mod_perl %s handler %s configured (connection)\n",
- type, handlers[i]->name);
+ "a non-mod_perl %s handler %s configured "
+ "(connection)\n", type, handlers[i]->name);
continue;
}
Modified: perl/modperl/trunk/t/conf/extra.conf.in
Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/conf/extra.conf.in?view=diff&rev=106472&p1=perl/modperl/trunk/t/conf/extra.conf.in&r1=106471&p2=perl/modperl/trunk/t/conf/extra.conf.in&r2=106472
==============================================================================
--- perl/modperl/trunk/t/conf/extra.conf.in (original)
+++ perl/modperl/trunk/t/conf/extra.conf.in Wed Nov 24 13:18:08 2004
@@ -88,3 +88,14 @@
# for TestApache::util
PerlPassEnv LC_CTYPE
PerlPassEnv LC_TIME
+
+# see t/filter/out_apache.t
+<VirtualHost filter_out_apache>
+ <IfModule mod_include.c>
+ # this filter is on purpose configured outside the Location
+ PerlSetOutputFilter INCLUDES
+ <Location />
+ Options +Includes
+ </Location>
+ </IfModule>
+</VirtualHost>
Added: perl/modperl/trunk/t/filter/out_apache.t
Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/t/filter/out_apache.t?view=auto&rev=106472
==============================================================================
--- (empty file)
+++ perl/modperl/trunk/t/filter/out_apache.t Wed Nov 24 13:18:08 2004
@@ -0,0 +1,37 @@
+# test the situation where a native apache response filter is
+# configured outside the <Location> block with PerlSet*Filter
+# directive. In this case we need to make sure that mod_perl doesn't
+# try to add it as connection filter
+
+# see the server side config in t/conf/extra.conf.in
+
+use strict;
+use warnings FATAL => 'all';
+
+use Apache::Test;
+use Apache::TestUtil;
+use Apache::TestRequest 'GET_BODY_ASSERT';
+use TestCommon::LogDiff;
+use File::Spec::Functions qw(catfile);
+
+my $path = catfile Apache::Test::vars('serverroot'),
+ qw(logs error_log);
+
+plan tests => 2, need 'include';
+
+my $module = 'filter_out_apache';
+my $config = Apache::Test::config();
+
+Apache::TestRequest::module($module);
+my $hostport = Apache::TestRequest::hostport($config);
+t_debug("connecting to $hostport");
+
+my $logdiff = TestCommon::LogDiff->new($path);
+
+my $expected = qr/welcome to/;
+my $response = GET_BODY_ASSERT "http://$hostport/";
+ok t_cmp $response, qr/$expected/, "success";
+
+ok !t_cmp $logdiff->diff,
+ qr/content filter was added without a request: includes/,
+ "shouldn't [error] complain in error_log";