stas        2003/11/22 00:26:00

  Modified:    src/modules/perl modperl_util.c
               .        Changes
  Log:
  fix slurp_filename to always open the file and not try to guess
  whether filename has been already opened, as there is no reliable way
  to accomplish that
  
  Revision  Changes    Path
  1.57      +13 -5     modperl-2.0/src/modules/perl/modperl_util.c
  
  Index: modperl_util.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -u -r1.56 -r1.57
  --- modperl_util.c    3 Nov 2003 09:29:49 -0000       1.56
  +++ modperl_util.c    22 Nov 2003 08:26:00 -0000      1.57
  @@ -706,12 +706,20 @@
       
       size = r->finfo.size;
       sv = newSV(size);
  -    file = r->finfo.filehand;
  -    if (!file) {
  -        rc = apr_file_open(&file, r->filename, APR_READ|APR_BINARY,
  -                           APR_OS_DEFAULT, r->pool);
  -        SLURP_SUCCESS("opening");
  +
  +    if (!size) {
  +        sv_setpvn(sv, "", 0);
  +        return newRV_noinc(sv);
       }
  +
  +    /* XXX: could have checked whether r->finfo.filehand is valid and
  +     * save the apr_file_open call, but apache gives us no API to
  +     * check whether filehand is valid. we can't test whether it's
  +     * NULL or not, as it may contain garbagea
  +     */
  +    rc = apr_file_open(&file, r->filename, APR_READ|APR_BINARY,
  +                       APR_OS_DEFAULT, r->pool);
  +    SLURP_SUCCESS("opening");
   
       rc = apr_file_read(file, SvPVX(sv), &size);
       SLURP_SUCCESS("reading");
  
  
  
  1.258     +4 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.257
  retrieving revision 1.258
  diff -u -u -r1.257 -r1.258
  --- Changes   22 Nov 2003 07:42:12 -0000      1.257
  +++ Changes   22 Nov 2003 08:26:00 -0000      1.258
  @@ -12,6 +12,10 @@
   
   =item 1.99_12-dev
   
  +fix slurp_filename to always open the file and not try to guess
  +whether filename has been already opened, as there is no reliable way
  +to accomplish that [Stas]
  +
   Apache->can_stack_handlers is now in Apache::compat (mp2 always can
   stack handlers) [Stas]
   
  
  
  

Reply via email to