dougm 01/04/19 14:26:47
Modified: src/modules/perl mod_perl.h modperl_filter.c modperl_mgv.c
modperl_types.h
t/conf modperl_extra.pl
xs modperl_xs_util.h
xs/Apache/Filter Apache__Filter.h
xs/maps modperl_types.map
xs/tables/current/ModPerl FunctionTable.pm
Log:
implement InputMessageFilters
Revision Changes Path
1.29 +5 -0 modperl-2.0/src/modules/perl/mod_perl.h
Index: mod_perl.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- mod_perl.h 2001/03/16 05:52:29 1.28
+++ mod_perl.h 2001/04/19 21:26:34 1.29
@@ -41,4 +41,9 @@
void modperl_response_finish(request_rec *r);
int modperl_response_handler(request_rec *r);
+/* betting on Perl*Handlers not using CvXSUBANY
+ * mod_perl reuses this field for handler attributes
+ */
+#define MP_CODE_ATTRS(cv) (CvXSUBANY((CV*)cv).any_i32)
+
#endif /* MOD_PERL_H */
1.14 +10 -2 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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- modperl_filter.c 2001/04/19 17:58:25 1.13
+++ modperl_filter.c 2001/04/19 21:26:35 1.14
@@ -397,8 +397,16 @@
int i;
for (i=0; i<av->nelts; i++) {
- modperl_filter_ctx_t *ctx =
- (modperl_filter_ctx_t *)apr_pcalloc(c->pool, sizeof(*ctx));
+ modperl_filter_ctx_t *ctx;
+
+ if (!(handlers[i]->attrs & MP_INPUT_FILTER_MESSAGE)) {
+ MP_TRACE_f(MP_FUNC,
+ "%s is not an InputFilterMessage handler\n",
+ handlers[i]->name);
+ continue;
+ }
+
+ ctx = (modperl_filter_ctx_t *)apr_pcalloc(c->pool, sizeof(*ctx));
ctx->handler = handlers[i];
ap_add_input_filter(MODPERL_INPUT_FILTER_NAME,
(void*)ctx, NULL, c);
1.13 +2 -0 modperl-2.0/src/modules/perl/modperl_mgv.c
Index: modperl_mgv.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_mgv.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- modperl_mgv.c 2001/04/02 07:37:12 1.12
+++ modperl_mgv.c 2001/04/19 21:26:35 1.13
@@ -277,6 +277,7 @@
}
else {
if ((cv = get_cv(name, FALSE))) {
+ handler->attrs = (U32)MP_CODE_ATTRS(cv);
handler->mgv_cv =
modperl_mgv_compile(aTHX_ p, HvNAME(GvSTASH(CvGV(cv))));
modperl_mgv_append(aTHX_ p, handler->mgv_cv, GvNAME(CvGV(cv)));
@@ -331,6 +332,7 @@
}
}
+ handler->attrs = (U32)MP_CODE_ATTRS(cv);
/* note: this is the real function after @ISA lookup */
handler->mgv_cv = modperl_mgv_compile(aTHX_ p, HvNAME(GvSTASH(gv)));
modperl_mgv_append(aTHX_ p, handler->mgv_cv, handler_name);
1.36 +1 -0 modperl-2.0/src/modules/perl/modperl_types.h
Index: modperl_types.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_types.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- modperl_types.h 2001/04/13 07:17:06 1.35
+++ modperl_types.h 2001/04/19 21:26:35 1.36
@@ -155,6 +155,7 @@
modperl_mgv_t *mgv_cv;
const char *name; /* orignal name from .conf if any */
U8 flags;
+ U32 attrs;
} modperl_handler_t;
#define MP_HANDLER_TYPE_CHAR 1
1.5 +2 -0 modperl-2.0/t/conf/modperl_extra.pl
Index: modperl_extra.pl
===================================================================
RCS file: /home/cvs/modperl-2.0/t/conf/modperl_extra.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- modperl_extra.pl 2001/04/19 20:20:37 1.4
+++ modperl_extra.pl 2001/04/19 21:26:38 1.5
@@ -7,6 +7,8 @@
use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';
+eval { require TestFilter::input_msg };
+
use APR::Table ();
sub ModPerl::Test::read_post {
1.6 +0 -2 modperl-2.0/xs/modperl_xs_util.h
Index: modperl_xs_util.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/modperl_xs_util.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- modperl_xs_util.h 2001/04/19 17:37:02 1.5
+++ modperl_xs_util.h 2001/04/19 21:26:40 1.6
@@ -1,8 +1,6 @@
#ifndef MODPERL_XS_H
#define MODPERL_XS_H
-#define MP_CODE_ATTRS(cv) (CvXSUBANY((CV*)cv).any_i32)
-
#ifndef dAX
# define dAX I32 ax = mark - PL_stack_base + 1
#endif
1.5 +12 -3 modperl-2.0/xs/Apache/Filter/Apache__Filter.h
Index: Apache__Filter.h
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/Apache/Filter/Apache__Filter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Apache__Filter.h 2001/04/19 17:38:54 1.4
+++ Apache__Filter.h 2001/04/19 21:26:42 1.5
@@ -56,16 +56,23 @@
return len;
}
-static MP_INLINE I32 *modperl_filter_attributes(SV *package, SV *cvrv)
+static MP_INLINE U32 *modperl_filter_attributes(SV *package, SV *cvrv)
{
- return &MP_CODE_ATTRS(SvRV(cvrv));
+ return (U32 *)&MP_CODE_ATTRS(SvRV(cvrv));
}
+#define trace_attr() \
+MP_TRACE_f(MP_FUNC, "apply %s to %s handler\n", attribute, \
+ HvNAME(stash))
+
static XS(MPXS_modperl_filter_attributes)
{
dXSARGS;
- I32 *attrs = modperl_filter_attributes(ST(0), ST(1));
+ U32 *attrs = modperl_filter_attributes(ST(0), ST(1));
I32 i;
+#ifdef MP_TRACE
+ HV *stash = gv_stashpv(SvPVX(ST(0)), TRUE);
+#endif
for (i=2; i < items; i++) {
STRLEN len;
@@ -80,11 +87,13 @@
case 'B':
if (strEQ(pv, "Body")) {
*attrs |= MP_INPUT_FILTER_BODY;
+ trace_attr();
continue;
}
case 'M':
if (strEQ(pv, "Message")) {
*attrs |= MP_INPUT_FILTER_MESSAGE;
+ trace_attr();
continue;
}
}
1.3 +2 -0 modperl-2.0/xs/maps/modperl_types.map
Index: modperl_types.map
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/maps/modperl_types.map,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- modperl_types.map 2001/04/19 17:41:42 1.2
+++ modperl_types.map 2001/04/19 21:26:44 1.3
@@ -7,4 +7,6 @@
SV * | SV
I32 | IV
I32 * | IV
+U32 | UV
+U32 * | UV
1.5 +24 -2 modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
Index: FunctionTable.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FunctionTable.pm 2001/04/19 17:45:28 1.4
+++ FunctionTable.pm 2001/04/19 21:26:46 1.5
@@ -2,7 +2,7 @@
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# ! WARNING: generated by ModPerl::ParseSource/0.01
-# ! Thu Apr 19 10:01:59 2001
+# ! Thu Apr 19 12:55:37 2001
# ! do NOT edit, any changes will be lost !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -707,6 +707,28 @@
'name' => 'modperl_handler_new'
},
{
+ 'return_type' => 'int',
+ 'args' => [
+ {
+ 'name' => 'my_perl',
+ 'type' => 'PerlInterpreter *'
+ },
+ {
+ 'name' => 'handp',
+ 'type' => 'modperl_handler_t **'
+ },
+ {
+ 'name' => 'p',
+ 'type' => 'apr_pool_t *'
+ },
+ {
+ 'name' => 's',
+ 'type' => 'server_rec *'
+ }
+ ],
+ 'name' => 'modperl_handler_resolve'
+ },
+ {
'return_type' => 'modperl_handler_t *',
'args' => [
{
@@ -3041,7 +3063,7 @@
'name' => 'mpxs_Apache__OutputFilter_read'
},
{
- 'return_type' => 'I32 *',
+ 'return_type' => 'U32 *',
'args' => [
{
'name' => 'package',