perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ge...@apache.org
Subject cvs commit: modperl-2.0/t/response/TestModperl current_callback.pm
Date Mon, 20 Oct 2003 19:37:29 GMT
geoff       2003/10/20 12:37:29

  Modified:    src/modules/perl modperl_callback.c
               t/modperl status.t
               t/response/TestModperl current_callback.pm
  Log:
  return value from Perl callbacks are now passed directly to Apache
  without additional post-call manipulations (such as assuming HTTP_OK
  should really be OK).
  Reviewed by:	stas
  
  Revision  Changes    Path
  1.64      +0 -6      modperl-2.0/src/modules/perl/modperl_callback.c
  
  Index: modperl_callback.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_callback.c,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- modperl_callback.c	11 Oct 2003 08:01:00 -0000	1.63
  +++ modperl_callback.c	20 Oct 2003 19:37:29 -0000	1.64
  @@ -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;
  
  
  
  1.3       +20 -13    modperl-2.0/t/modperl/status.t
  
  Index: status.t
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/modperl/status.t,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- status.t	15 Oct 2003 12:38:36 -0000	1.2
  +++ status.t	20 Oct 2003 19:37:29 -0000	1.3
  @@ -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);
   }
   
  
  
  
  1.4       +1 -0      modperl-2.0/t/response/TestModperl/current_callback.pm
  
  Index: current_callback.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/t/response/TestModperl/current_callback.pm,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- current_callback.pm	31 Mar 2003 01:50:52 -0000	1.3
  +++ current_callback.pm	20 Oct 2003 19:37:29 -0000	1.4
  @@ -36,6 +36,7 @@
       die "expecting $expected callback, instead got $callback" 
           unless $callback eq $expected;
       #warn "in callback: $callback\n";
  +    return Apache::OK;
   }
   
   1;
  
  
  

Mime
View raw message