stas 2004/09/09 08:08:04
Modified: . Changes
src/modules/perl modperl_error.c modperl_error.h
modperl_filter.c
Log:
introduce a custom modperl error message for failing filter handlers
(previously 'unknown error' coming from rc=500 was logged)
Revision Changes Path
1.476 +3 -0 modperl-2.0/Changes
Index: Changes
===================================================================
RCS file: /home/cvs/modperl-2.0/Changes,v
retrieving revision 1.475
retrieving revision 1.476
diff -u -u -r1.475 -r1.476
--- Changes 8 Sep 2004 23:41:17 -0000 1.475
+++ Changes 9 Sep 2004 15:08:03 -0000 1.476
@@ -12,6 +12,9 @@
=item 1.99_17-dev
+introduce a custom modperl error message for failing filter handlers
+(previously 'unknown error' coming from rc=500 was logged) [Stas]
+
$s->log->warn and other $s->log->foo are now logging to the right
vhost server and not the global one. modperl_sv2server_rec was
broken. [Stas]
1.7 +3 -2 modperl-2.0/src/modules/perl/modperl_error.c
Index: modperl_error.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_error.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- modperl_error.c 13 Aug 2004 01:49:54 -0000 1.6
+++ modperl_error.c 9 Sep 2004 15:08:03 -0000 1.7
@@ -16,7 +16,8 @@
#include "mod_perl.h"
static const char *MP_error_strings[] = {
- "exit was called", /* MODPERL_RC_EXIT */
+ "exit was called", /* MODPERL_RC_EXIT */
+ "filter handler has failed", /* MODPERL_FILTER_ERROR */
};
#define MP_error_strings_size \
@@ -40,7 +41,7 @@
/* must copy the string and not return a pointer to the local
* address. Using a single (per interpreter) static buffer.
*/
- return Perl_form(aTHX_ "%s", ptr);
+ return Perl_form(aTHX_ "%s", ptr ? ptr : "unknown error");
}
1.3 +5 -2 modperl-2.0/src/modules/perl/modperl_error.h
Index: modperl_error.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_error.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -u -r1.2 -r1.3
--- modperl_error.h 10 May 2004 01:21:24 -0000 1.2
+++ modperl_error.h 9 Sep 2004 15:08:03 -0000 1.3
@@ -16,9 +16,12 @@
#ifndef MODPERL_ERROR_H
#define MODPERL_ERROR_H
-/* to check whether $@ is set by ModPerl::Util::exit */
-#define MODPERL_RC_EXIT APR_OS_START_USERERR + 0
+/*** mod_perl custom errors come here ***/
+/* to check whether $@ is set by ModPerl::Util::exit */
+#define MODPERL_RC_EXIT APR_OS_START_USERERR + 0
+/* indicate the filter error problem */
+#define MODPERL_FILTER_ERROR APR_OS_START_USERERR + 1
/**
* return the string representation of the error code
1.97 +4 -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.96
retrieving revision 1.97
diff -u -u -r1.96 -r1.97
--- modperl_filter.c 18 Aug 2004 22:45:46 -0000 1.96
+++ modperl_filter.c 9 Sep 2004 15:08:03 -0000 1.97
@@ -924,6 +924,10 @@
return APR_SUCCESS;
case DECLINED:
return ap_get_brigade(f->next, bb, input_mode, block, readbytes);
+ case HTTP_INTERNAL_SERVER_ERROR:
+ /* XXX: later may introduce separate error codes for
+ * modperl_run_filter and modperl_run_filter_init */
+ return MODPERL_FILTER_ERROR;
default:
return status; /*XXX*/
}