hi all

in continuing the discussion from last week (or was it the week before) where we decided to fix the PL_sv_undef thing first then re-examine modperl_callback's second-guessing the return value of the Perl callback...

attached is a patch that fixes things to how I think they should work

--Geoff
Index: src/modules/perl/modperl_callback.c
===================================================================
RCS file: /home/cvspublic/modperl-2.0/src/modules/perl/modperl_callback.c,v
retrieving revision 1.63
diff -u -r1.63 modperl_callback.c
--- src/modules/perl/modperl_callback.c 11 Oct 2003 08:01:00 -0000      1.63
+++ src/modules/perl/modperl_callback.c 20 Oct 2003 16:11:00 -0000
@@ -100,12 +100,6 @@
                              "handler %s didn't return a valid return value!",
                              handler->name);
             }
-
-            /* assume OK for non-HTTP status codes and for 200 (HTTP_OK) */
-            if (((status > 0) && (status < 100)) ||
-                (status == 200) || (status > 600)) {
-                status = OK;
-            }
         }
 
         PUTBACK;
Index: t/modperl/status.t
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/modperl/status.t,v
retrieving revision 1.2
diff -u -r1.2 status.t
--- t/modperl/status.t  15 Oct 2003 12:38:36 -0000      1.2
+++ t/modperl/status.t  20 Oct 2003 16:11:01 -0000
@@ -10,7 +10,7 @@
                                  NOT_FOUND SERVER_ERROR FORBIDDEN
                                  HTTP_OK);
 
-plan tests => 14;
+plan tests => 15;
 
 my $base = "/TestModperl__status";
 
@@ -62,21 +62,22 @@
              $uri);
 }
 
-# the return code guessing game
+# apache translates non-HTTP codes into 500
+# see ap_index_of_response
 {
-    my $uri = join '?', $base, Apache::HTTP_OK;
+    my $uri = join '?', $base, 601;
     my $code = GET_RC $uri;
 
-    ok t_cmp(Apache::HTTP_OK, 
+    ok t_cmp(Apache::SERVER_ERROR, 
              $code,
              $uri);
 }
 
 {
-    my $uri = join '?', $base, 601;
+    my $uri = join '?', $base, 313;
     my $code = GET_RC $uri;
 
-    ok t_cmp(Apache::HTTP_OK, 
+    ok t_cmp(Apache::SERVER_ERROR, 
              $code,
              $uri);
 }
@@ -85,19 +86,25 @@
     my $uri = join '?', $base, 1;
     my $code = GET_RC $uri;
 
-    ok t_cmp(Apache::HTTP_OK, 
+    ok t_cmp(Apache::SERVER_ERROR, 
              $code,
              $uri);
 }
 
-# apache translates non-HTTP codes into 500
-# see ap_index_of_response
+# HTTP_OK is treated as an error, since it's not
+# OK, DECLINED, or DONE.  while apache's lookups
+# succeed so the 200 is propagated to the client,
+# there's an error beneath that 200 code.
 {
-    my $uri = join '?', $base, 313;
-    my $code = GET_RC $uri;
+    my $uri = join '?', $base, Apache::HTTP_OK;
+    my $response = GET $uri;
 
-    ok t_cmp(Apache::SERVER_ERROR, 
-             $code,
+    ok t_cmp(Apache::HTTP_OK,
+             $response->code,
+             $uri);
+
+    ok t_cmp(qr/server encountered an internal error/,
+             $response->content,
              $uri);
 }
 
Index: t/response/TestModperl/current_callback.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/t/response/TestModperl/current_callback.pm,v
retrieving revision 1.3
diff -u -r1.3 current_callback.pm
--- t/response/TestModperl/current_callback.pm  31 Mar 2003 01:50:52 -0000      1.3
+++ t/response/TestModperl/current_callback.pm  20 Oct 2003 16:11:01 -0000
@@ -36,6 +36,7 @@
     die "expecting $expected callback, instead got $callback" 
         unless $callback eq $expected;
     #warn "in callback: $callback\n";
+    return Apache::OK;
 }
 
 1;

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to