stas        2003/01/30 19:15:24

  Modified:    xs/Apache/RequestUtil Apache__RequestUtil.h
               .        Changes
  Added:       t/response/TestError api.pm
  Log:
  die when Apache->request returns nothing ('PerlOptions -GlobalRequest'
  or 'SetHandler modperl'
  
  Revision  Changes    Path
  1.16      +8 -1      modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h
  
  Index: Apache__RequestUtil.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestUtil/Apache__RequestUtil.h,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- Apache__RequestUtil.h     11 Jan 2003 00:02:16 -0000      1.15
  +++ Apache__RequestUtil.h     31 Jan 2003 03:15:23 -0000      1.16
  @@ -89,9 +89,16 @@
       apr_status_t status = modperl_tls_get_request_rec(&cur);
   
       if (status != APR_SUCCESS) {
  -        /* XXX: croak */
  +        /* an internal problem */
  +        Perl_croak(aTHX_ "failed to retrieve the request object");
       }
   
  +    if (!cur) {
  +        /* wrong configuration */
  +        Perl_croak(aTHX_ "Global $r object is not available. Set:\n"
  +                   "\tPerlOptions +GlobalRequest\nin httpd.conf");
  +    }
  +    
       if (svr) {
           modperl_global_request_obj_set(aTHX_ svr);
       }
  
  
  
  1.1                  modperl-2.0/t/response/TestError/api.pm
  
  Index: api.pm
  ===================================================================
  package TestError::api;
  
  use strict;
  use warnings FATAL => 'all';
  
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  
  use Apache::Test;
  use Apache::TestUtil;
  
  use Apache::Const -compile => qw(OK);
  
  sub handler {
      my $r = shift;
  
      plan $r, tests => 1;
  
      $r->content_type('text/plain');
  
      # PerlOptions -GlobalRequest is in effect
      eval { Apache->request; };
      ok t_cmp(qr/\$r object is not available/,
          $@, "unavailable global $r object");
  
      return Apache::OK;
  }
  
  1;
  __END__
  PerlOptions -GlobalRequest
  
  
  
  1.118     +3 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- Changes   29 Jan 2003 03:56:00 -0000      1.117
  +++ Changes   31 Jan 2003 03:15:24 -0000      1.118
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +die when Apache->request returns nothing ('PerlOptions -GlobalRequest'
  +or 'SetHandler modperl' [Stas]
  +
   New Apache::Directive methods: as_hash(), lookup() + tests + docs
   [Philippe M. Chiasson <[EMAIL PROTECTED]>]
   
  
  
  


Reply via email to