stas2003/01/22 16:31:28
Modified:src/modules/perl mod_perl.c mod_perl.h modperl_filter.c
modperl_util.h
.Changes
xs/Apache/RequestIO Apache__RequestIO.h
xs/Apache/SubRequest Apache__SubRequest.h
xs/tables/current/ModPerl FunctionTable.pm
Log:
- add a new MP_FAILURE_CROAK macro to handle failures
- all response functions are now returning status and the callers check
and croak on failure or progate them further.
Revision ChangesPath
1.147 +10 -4 modperl-2.0/src/modules/perl/mod_perl.c
Index: mod_perl.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -r1.146 -r1.147
--- mod_perl.c12 Jan 2003 02:15:58 - 1.146
+++ mod_perl.c23 Jan 2003 00:31:28 - 1.147
@@ -709,12 +709,12 @@
wb-r = r;
}
-void modperl_response_finish(request_rec *r)
+apr_status_t modperl_response_finish(request_rec *r)
{
MP_dRCFG;
/* flush output buffer */
-modperl_wbucket_flush(rcfg-wbucket);
+return modperl_wbucket_flush(rcfg-wbucket);
}
static int modperl_response_handler_run(request_rec *r, int finish)
@@ -730,7 +730,10 @@
}
if (finish) {
-modperl_response_finish(r);
+apr_status_t rc = modperl_response_finish(r);
+if (rc != APR_SUCCESS) {
+retval = rc;
+}
}
return retval;
@@ -803,7 +806,10 @@
#endif
/* flush output buffer after interpreter is putback */
-modperl_response_finish(r);
+apr_status_t rc = modperl_response_finish(r);
+if (rc != APR_SUCCESS) {
+retval = rc;
+}
switch (rcfg-status) {
case HTTP_MOVED_TEMPORARILY:
1.56 +1 -1 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.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- mod_perl.h12 Dec 2002 10:05:08 - 1.55
+++ mod_perl.h23 Jan 2003 00:31:28 - 1.56
@@ -88,7 +88,7 @@
void xs_init(pTHX);
void modperl_response_init(request_rec *r);
-void modperl_response_finish(request_rec *r);
+apr_status_t modperl_response_finish(request_rec *r);
int modperl_response_handler(request_rec *r);
int modperl_response_handler_cgi(request_rec *r);
1.45 +5 -6 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.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- modperl_filter.c 17 Jan 2003 03:08:31 - 1.44
+++ modperl_filter.c 23 Jan 2003 00:31:28 - 1.45
@@ -23,6 +23,8 @@
ap_log_error(APLOG_MARK, APLOG_WARNING,
0, r-server, %s did not send an HTTP header,
r-uri);
+/* XXX: bodytext == NULL here */
+return status;
}
else if (!bodytext) {
return APR_SUCCESS;
@@ -190,17 +192,14 @@
* first modperl_input_filter_read, so it must be
* destroyed at the end of the filter invocation
*/
-/* XXX: may be the filter must consume all the data? add a
- * test to check */
apr_brigade_destroy(filter-bb_in);
filter-bb_in = NULL;
}
-modperl_input_filter_flush(filter);
+MP_FAILURE_CROAK(modperl_input_filter_flush(filter));
}
else {
-modperl_output_filter_flush(filter);
+MP_FAILURE_CROAK(modperl_output_filter_flush(filter));
}
-
return status;
}
@@ -457,7 +456,7 @@
if (filter-flush len == 0) {
/* if len 0 then $filter-write will flush */
-modperl_output_filter_flush(filter);
+MP_FAILURE_CROAK(modperl_output_filter_flush(filter));
}
return len;
1.38 +7 -0 modperl-2.0/src/modules/perl/modperl_util.h
Index: modperl_util.h
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- modperl_util.h11 Jan 2003 00:02:16 - 1.37
+++ modperl_util.h23 Jan 2003 00:31:28 - 1.38
@@ -50,6 +50,13 @@
#define MP_magical_tie(sv, mg_flags) \
SvFLAGS((SV*)sv) |= mg_flags
+#define