stas        2003/01/22 16:31:28

  Modified:    src/modules/perl mod_perl.c mod_perl.h modperl_filter.c
                        modperl_util.h
               .        Changes
               xs/Apache/RequestIO Apache__RequestIO.h
               xs/Apache/SubRequest Apache__SubRequest.h
               xs/tables/current/ModPerl FunctionTable.pm
  Log:
  - add a new MP_FAILURE_CROAK macro to handle failures
  - all response functions are now returning status and the callers check
  and croak on failure or progate them further.
  
  Revision  Changes    Path
  1.147     +10 -4     modperl-2.0/src/modules/perl/mod_perl.c
  
  Index: mod_perl.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.c,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -u -r1.146 -r1.147
  --- mod_perl.c        12 Jan 2003 02:15:58 -0000      1.146
  +++ mod_perl.c        23 Jan 2003 00:31:28 -0000      1.147
  @@ -709,12 +709,12 @@
       wb->r = r;
   }
   
  -void modperl_response_finish(request_rec *r)
  +apr_status_t modperl_response_finish(request_rec *r)
   {
       MP_dRCFG;
   
       /* flush output buffer */
  -    modperl_wbucket_flush(rcfg->wbucket);
  +    return modperl_wbucket_flush(rcfg->wbucket);
   }
   
   static int modperl_response_handler_run(request_rec *r, int finish)
  @@ -730,7 +730,10 @@
       }
   
       if (finish) {
  -        modperl_response_finish(r);
  +        apr_status_t rc = modperl_response_finish(r);
  +        if (rc != APR_SUCCESS) {
  +            retval = rc;
  +        }
       }
   
       return retval;
  @@ -803,7 +806,10 @@
   #endif
   
       /* flush output buffer after interpreter is putback */
  -    modperl_response_finish(r);
  +    apr_status_t rc = modperl_response_finish(r);
  +    if (rc != APR_SUCCESS) {
  +        retval = rc;
  +    }
   
       switch (rcfg->status) {
         case HTTP_MOVED_TEMPORARILY:
  
  
  
  1.56      +1 -1      modperl-2.0/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/mod_perl.h,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- mod_perl.h        12 Dec 2002 10:05:08 -0000      1.55
  +++ mod_perl.h        23 Jan 2003 00:31:28 -0000      1.56
  @@ -88,7 +88,7 @@
   void xs_init(pTHX);
   
   void modperl_response_init(request_rec *r);
  -void modperl_response_finish(request_rec *r);
  +apr_status_t modperl_response_finish(request_rec *r);
   int modperl_response_handler(request_rec *r);
   int modperl_response_handler_cgi(request_rec *r);
   
  
  
  
  1.45      +5 -6      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.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- modperl_filter.c  17 Jan 2003 03:08:31 -0000      1.44
  +++ modperl_filter.c  23 Jan 2003 00:31:28 -0000      1.45
  @@ -23,6 +23,8 @@
               ap_log_error(APLOG_MARK, APLOG_WARNING,
                            0, r->server, "%s did not send an HTTP header",
                            r->uri);
  +            /* XXX: bodytext == NULL here */
  +            return status;
           }
           else if (!bodytext) {
               return APR_SUCCESS;
  @@ -190,17 +192,14 @@
                * first modperl_input_filter_read, so it must be
                * destroyed at the end of the filter invocation
                */
  -            /* XXX: may be the filter must consume all the data? add a
  -             * test to check */
               apr_brigade_destroy(filter->bb_in);
               filter->bb_in = NULL;
           }
  -        modperl_input_filter_flush(filter);
  +        MP_FAILURE_CROAK(modperl_input_filter_flush(filter));
       }
       else {
  -        modperl_output_filter_flush(filter);
  +        MP_FAILURE_CROAK(modperl_output_filter_flush(filter));
       }
  -    
   
       return status;
   }
  @@ -457,7 +456,7 @@
       
       if (filter->flush && len == 0) {
           /* if len > 0 then $filter->write will flush */
  -        modperl_output_filter_flush(filter);
  +        MP_FAILURE_CROAK(modperl_output_filter_flush(filter));
       }
   
       return len;
  
  
  
  1.38      +7 -0      modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- modperl_util.h    11 Jan 2003 00:02:16 -0000      1.37
  +++ modperl_util.h    23 Jan 2003 00:31:28 -0000      1.38
  @@ -50,6 +50,13 @@
   #define MP_magical_tie(sv, mg_flags) \
       SvFLAGS((SV*)sv) |= mg_flags
   
  +#define MP_FAILURE_CROAK(rc_run) do { \
  +        apr_status_t rc = rc_run; \
  +        if (rc != APR_SUCCESS) { \
  +            Perl_croak(aTHX_ modperl_apr_strerror(rc)); \
  +        } \
  +    } while (0)
  +        
   MP_INLINE server_rec *modperl_sv2server_rec(pTHX_ SV *sv);
   MP_INLINE request_rec *modperl_sv2request_rec(pTHX_ SV *sv);
   
  
  
  
  1.110     +3 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.109
  retrieving revision 1.110
  diff -u -r1.109 -r1.110
  --- Changes   22 Jan 2003 07:02:14 -0000      1.109
  +++ Changes   23 Jan 2003 00:31:28 -0000      1.110
  @@ -10,6 +10,9 @@
   
   =item 1.99_09-dev
   
  +All response functions are now returning status and the callers check
  +and croak on failure or progate them further. [Stas]
  +
   Apache::Test: support two new shortcuts for skip functionality:
    - have_threads: checks whether both Apache and Perl support threads
    - under_construction: to print a consistent/clear skip reason
  
  
  
  1.33      +6 -4      modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h
  
  Index: Apache__RequestIO.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/RequestIO/Apache__RequestIO.h,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Apache__RequestIO.h       22 Jan 2003 06:12:43 -0000      1.32
  +++ Apache__RequestIO.h       23 Jan 2003 00:31:28 -0000      1.33
  @@ -23,7 +23,7 @@
   #define mpxs_output_flush(r, rcfg) \
       /* if ($|) */ \
       if (IoFLUSH(PL_defoutgv)) { \
  -        modperl_wbucket_flush(rcfg->wbucket); \
  +        MP_FAILURE_CROAK(modperl_wbucket_flush(rcfg->wbucket)); \
           ap_rflush(r); \
       }
   
  @@ -94,7 +94,8 @@
       modperl_perl_do_sprintf(aTHX_ sv, items, MARK);
       bytes = SvCUR(sv);
   
  -    modperl_wbucket_write(aTHX_ rcfg->wbucket, SvPVX(sv), &bytes);
  +    MP_FAILURE_CROAK(modperl_wbucket_write(aTHX_ rcfg->wbucket,
  +                                           SvPVX(sv), &bytes));
       
       mpxs_output_flush(r, rcfg);
   
  @@ -126,8 +127,9 @@
           wlen = bufsiz;
       }
   
  -    modperl_wbucket_write(aTHX_ rcfg->wbucket, buf+offset, &wlen);
  -
  +    MP_FAILURE_CROAK(modperl_wbucket_write(aTHX_ rcfg->wbucket,
  +                                           buf+offset, &wlen));
  +    
       return wlen;
   }
   
  
  
  
  1.2       +2 -3      modperl-2.0/xs/Apache/SubRequest/Apache__SubRequest.h
  
  Index: Apache__SubRequest.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/Apache/SubRequest/Apache__SubRequest.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Apache__SubRequest.h      26 Feb 2002 19:03:58 -0000      1.1
  +++ Apache__SubRequest.h      23 Jan 2003 00:31:28 -0000      1.2
  @@ -6,9 +6,8 @@
        */
   
       if (r->main) {
  -        modperl_config_req_t *rcfg =
  -            modperl_config_req_get(r->main);
  -        modperl_wbucket_flush(rcfg->wbucket);
  +        modperl_config_req_t *rcfg = modperl_config_req_get(r->main);
  +        MP_FAILURE_CROAK(modperl_wbucket_flush(rcfg->wbucket));
       }
   
       return ap_run_sub_req(r);
  
  
  
  1.99      +1 -1      modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm
  
  Index: FunctionTable.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/xs/tables/current/ModPerl/FunctionTable.pm,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- FunctionTable.pm  22 Jan 2003 06:12:43 -0000      1.98
  +++ FunctionTable.pm  23 Jan 2003 00:31:28 -0000      1.99
  @@ -3740,7 +3740,7 @@
       ]
     },
     {
  -    'return_type' => 'void',
  +    'return_type' => 'apr_status_t',
       'name' => 'modperl_response_finish',
       'args' => [
         {
  
  
  


Reply via email to