[prev in list] [next in list] [prev in thread] [next in thread]
List: apache-modperl-cvs
Subject: cvs commit: modperl-2.0 Changes
From: stas () apache ! org
Date: 2003-09-23 23:52:49
[Download RAW message or body]
stas 2003/09/23 16:52:49
Modified: src/modules/perl modperl_filter.c
t/filter/TestFilter both_str_con_add.pm
. Changes
Log:
($r|$c)->add_(input|output)_filter(\&handler) now verify that the
filter of the right kind is passed and will refuse to add a request
filter as a connection filter and vice versa. The request filter
handler is not required to have the FilterRequestHandler attribute as
long as it doesn't have any other attributes. The connection filter
handler is required to have the FilterConnectionHandler
attribute.
Revision Changes Path
1.70 +25 -0 modperl-2.0/src/modules/perl/modperl_filter.c
Index: modperl_filter.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_filter.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -u -r1.69 -r1.70
--- modperl_filter.c 23 Sep 2003 20:12:11 -0000 1.69
+++ modperl_filter.c 23 Sep 2003 23:52:49 -0000 1.70
@@ -1020,6 +1020,31 @@
Perl_croak(aTHX_ "unable to resolve handler %s\n", handler->name);
}
+ /* verify that the filter handler is of the right kind */
+ if (r == NULL) {
+ /* needs to have the FilterConnectionHandler attribute */
+ if (!(handler->attrs & MP_FILTER_CONNECTION_HANDLER)) {
+ Perl_croak(aTHX_ "Can't add connection filter handler '%s' "
+ "since it doesn't have the "
+ "FilterConnectionHandler attribute set",
+ handler->name);
+ }
+ }
+ else {
+ /* needs to have the FilterRequestHandler attribute, but
+ * since by default request filters are not required to
+ * have the FilterRequestHandler attribute, croak only if
+ * some other attribute is set, but not
+ * FilterRequestHandler */
+ if (handler->attrs &&
+ !(handler->attrs & MP_FILTER_REQUEST_HANDLER)) {
+ Perl_croak(aTHX_ "Can't add request filter handler '%s' "
+ "since it doesn't have the "
+ "FilterRequestHandler attribute set",
+ handler->name);
+ }
+ }
+
if (handler->attrs & MP_FILTER_HAS_INIT_HANDLER && handler->next) {
int status = modperl_run_filter_init(f, mode, handler->next);
if (status != OK) {
1.7 +5 -6 modperl-2.0/t/filter/TestFilter/both_str_con_add.pm
Index: both_str_con_add.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/both_str_con_add.pm,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- both_str_con_add.pm 11 May 2003 23:51:11 -0000 1.6
+++ both_str_con_add.pm 23 Sep 2003 23:52:49 -0000 1.7
@@ -7,15 +7,14 @@
use warnings FATAL => 'all';
use Apache::Connection ();
-use Apache::Filter ();
use APR::Bucket ();
use APR::Brigade ();
use APR::Util ();
-use APR::Const -compile => qw(SUCCESS EOF);
-use Apache::Const -compile => qw(OK MODE_GETLINE);
+use base qw(Apache::Filter);
-use Apache::Const -compile => qw(OK);
+use APR::Const -compile => qw(SUCCESS EOF);
+use Apache::Const -compile => qw(OK MODE_GETLINE);
sub pre_connection {
my Apache::Connection $c = shift;
@@ -25,7 +24,7 @@
return Apache::OK;
}
-sub in_filter {
+sub in_filter : FilterConnectionHandler {
my $filter = shift;
while ($filter->read(my $buffer, 1024)) {
@@ -38,7 +37,7 @@
Apache::OK;
}
-sub out_filter {
+sub out_filter : FilterConnectionHandler {
my $filter = shift;
while ($filter->read(my $buffer, 1024)) {
1.220 +8 -0 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.219
retrieving revision 1.220
diff -u -u -r1.219 -r1.220
--- Changes 23 Sep 2003 08:04:42 -0000 1.219
+++ Changes 23 Sep 2003 23:52:49 -0000 1.220
@@ -12,6 +12,14 @@
=item 1.99_10-dev
+($r|$c)->add_(input|output)_filter(\&handler) now verify that the
+filter of the right kind is passed and will refuse to add a request
+filter as a connection filter and vice versa. The request filter
+handler is not required to have the FilterRequestHandler attribute as
+long as it doesn't have any other attributes. The connection filter
+handler is required to have the FilterConnectionHandler
+attribute. [Stas]
+
fix tracing with (PerlTrace/MOD_PERL_TRACE) on win32 (the error_log
filehandle was invalid after the open_logs phase) [Stas]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic