Author: stas
Date: Sat Dec 11 07:45:49 2004
New Revision: 111597

URL: http://svn.apache.org/viewcvs?view=rev&rev=111597
Log:
open_logs and post_config handlers require the Apache::OK return code
or the server aborts, so we need to log an error in case the handler
didn't fail but returned something different from Apache::OK

Modified:
   perl/modperl/trunk/Changes
   perl/modperl/trunk/src/modules/perl/modperl_callback.c

Modified: perl/modperl/trunk/Changes
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=111597&p1=perl/modperl/trunk/Changes&r1=111596&p2=perl/modperl/trunk/Changes&r2=111597
==============================================================================
--- perl/modperl/trunk/Changes  (original)
+++ perl/modperl/trunk/Changes  Sat Dec 11 07:45:49 2004
@@ -12,6 +12,10 @@
 
 =item 1.99_18-dev
 
+open_logs and post_config handlers require the Apache::OK return code
+or the server aborts, so we need to log an error in case the handler
+didn't fail but returned something different from Apache::OK [Stas]
+
 new function ModPerl::Util::current_perl_id() which returns something
 like (.e.g 0x92ac760) (aTHX) under threaded mpm and 0 under
 non-threaded perl (0x0). Useful for debugging modperl under threaded

Modified: perl/modperl/trunk/src/modules/perl/modperl_callback.c
Url: 
http://svn.apache.org/viewcvs/perl/modperl/trunk/src/modules/perl/modperl_callback.c?view=diff&rev=111597&p1=perl/modperl/trunk/src/modules/perl/modperl_callback.c&r1=111596&p2=perl/modperl/trunk/src/modules/perl/modperl_callback.c&r2=111597
==============================================================================
--- perl/modperl/trunk/src/modules/perl/modperl_callback.c      (original)
+++ perl/modperl/trunk/src/modules/perl/modperl_callback.c      Sat Dec 11 
07:45:49 2004
@@ -271,11 +271,30 @@
          */
 
         if (run_mode == MP_HOOK_RUN_ALL) {
+            /* special case */
+            if (type == MP_HANDLER_TYPE_FILES && status != OK) {
+                /* open_logs and post_config require OK return code or
+                 * the server aborts, so we need to log an error in
+                 * case the handler didn't fail but returned something
+                 * different from OK */
+                if (SvTRUE(ERRSV)) {
+                    status = modperl_errsv(aTHX_ status, r, s);
+                }
+                else {
+                    ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
+                                 "Callback '%s' returned %d, whereas "
+                                 "Apache::OK (%d) is the only valid "
+                                 "return value for %s handlers",
+                                 modperl_handler_name(handlers[i]),
+                                 status, OK, desc);
+                }
+                break;
+            }
             /* the normal case:
              *   OK and DECLINED continue 
              *   errors end the phase
              */
-            if ((status != OK) && (status != DECLINED)) {
+            else if ((status != OK) && (status != DECLINED)) {
 
                 status = modperl_errsv(aTHX_ status, r, s);
 #ifdef MP_TRACE

Reply via email to