httpd-apreq-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cvs commit: httpd-apreq-2/src apreq.c apreq_version.h
Date Fri, 23 Jul 2004 17:22:54 GMT
joes        2004/07/23 10:22:54

  Modified:    .        CHANGES STATUS
               src      apreq.c apreq_version.h
  Log:
    Drop APR_DELONCLOSE from apreq_file_mktemp implementation and install
    apreq_file_cleanup. When passed to apr_file_open on Win32, APR_DELONCLOSE
    sets the FILE_SHARED_DELETE flag, which is, unfortunately, a property that
    is preserved across NTFS "hard" links.  This breaks apps that link()
    the temp file to a permanent location, and subsequently expect to open it
    without FILE_SHARED_DELETE before the original tempfile is closed+deleted.
    In fact, even Apache::Upload does this, so it is a common enough event that
    the apreq_file_cleanup workaround is necessary.
  
  Revision  Changes    Path
  1.57      +10 -0     httpd-apreq-2/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/CHANGES,v
  retrieving revision 1.56
  retrieving revision 1.57
  diff -u -r1.56 -r1.57
  --- CHANGES	9 Jul 2004 23:00:38 -0000	1.56
  +++ CHANGES	23 Jul 2004 17:22:53 -0000	1.57
  @@ -4,6 +4,16 @@
   
   @section v2_04_dev Changes with libapreq2-2.04-dev
   
  +- C API [Markus Wichitill, randyk, joes]
  +  Drop APR_DELONCLOSE from apreq_file_mktemp implementation and install
  +  apreq_file_cleanup. When passed to apr_file_open on Win32, APR_DELONCLOSE 
  +  sets the FILE_SHARED_DELETE flag, which is, unfortunately, a property that
  +  is preserved across NTFS "hard" links.  This breaks apps that link() 
  +  the temp file to a permanent location, and subsequently expect to open it 
  +  without FILE_SHARED_DELETE before the original tempfile is closed+deleted. 
  +  In fact, even Apache::Upload does this, so it is a common enough event that
  +  the apreq_file_cleanup workaround is necessary.
  +
   - C API [Ken Burcham, joes]
     Fix bug in url parser that occurs when a %XX-encoded sequence
     is split across multiple buckets.  Added apreq_decode_decodev
  
  
  
  1.77      +1 -8      httpd-apreq-2/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/STATUS,v
  retrieving revision 1.76
  retrieving revision 1.77
  diff -u -r1.76 -r1.77
  --- STATUS	23 Jul 2004 07:21:14 -0000	1.76
  +++ STATUS	23 Jul 2004 17:22:53 -0000	1.77
  @@ -50,13 +50,6 @@
   
   TODO:
   
  -    - use of APR_DELONCLOSE in apreq_file_mktemp, to delete
  -      temp files after they're done, requires on Win32 use of
  -      open $fh, "<:APR", ..., rather than just open $fh, "<", ...
  -      when opening such files. Should remove APR_DELONCLOSE
  -      in apreq_file_mktemp, and instead use a pool cleanup to
  -      delete the temp file.
  -
       - in glue/perl/t/apreq/cgi.t on Win32, printing to the error log
         hangs if the strings involved are about 10000 in size.
         This doesn't occur in the env/cgi tests - why?
  
  
  
  1.47      +34 -2     httpd-apreq-2/src/apreq.c
  
  Index: apreq.c
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- apreq.c	18 Jul 2004 20:41:51 -0000	1.46
  +++ apreq.c	23 Jul 2004 17:22:54 -0000	1.47
  @@ -736,6 +736,30 @@
       return APR_SUCCESS;
   }
   
  +
  +
  +static apr_status_t apreq_file_cleanup(void *f)
  +{
  +    apr_file_t *file = f;
  +    apr_finfo_t finfo;
  +
  +    apr_file_info_get(&finfo, APR_FINFO_NAME, file);
  +
  +    apr_file_close(file); /*deregister any other pool cleanups */
  +    return apr_file_remove(finfo.fname, finfo.pool);
  +}
  +
  +/*
  + * The reason we need the above cleanup is because on Windows, APR_DELONCLOSE
  + * forces applications to open the file with FILE_SHARED_DELETE
  + * set, which is, unfortunately, a property that is preserved 
  + * across NTFS "hard" links.  This breaks apps that link() the temp 
  + * file to a permanent location, and subsequently expect to open it 
  + * before the original tempfile is closed+deleted. In fact, even
  + * Apache::Upload does this, so it is a common enough event that the
  + * apreq_file_cleanup workaround is necessary.
  + */
  +
   APREQ_DECLARE(apr_status_t) apreq_file_mktemp(apr_file_t **fp, 
                                                 apr_pool_t *pool,
                                                 const char *path)
  @@ -754,9 +778,17 @@
       if (rc != APR_SUCCESS)
           return rc;
       
  -    return apr_file_mktemp(fp, tmpl,
  +    rc = apr_file_mktemp(fp, tmpl, /* NO APR_DELONCLOSE! see comment above */
                              APR_CREATE | APR_READ | APR_WRITE
  -                           | APR_EXCL | APR_DELONCLOSE | APR_BINARY, pool);
  +                           | APR_EXCL | APR_BINARY, pool);
  +
  +    /* cleanups are LIFO, so this one will run first, thus removing the 
  +       one just set by mktemp */
  +    apr_pool_cleanup_register(pool, (void *)(*fp), 
  +                              apreq_file_cleanup, apreq_file_cleanup);
  +
  +
  +    return rc;
   }
   
   
  
  
  
  1.21      +1 -1      httpd-apreq-2/src/apreq_version.h
  
  Index: apreq_version.h
  ===================================================================
  RCS file: /home/cvs/httpd-apreq-2/src/apreq_version.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- apreq_version.h	9 Jul 2004 23:00:38 -0000	1.20
  +++ apreq_version.h	23 Jul 2004 17:22:54 -0000	1.21
  @@ -61,7 +61,7 @@
   #define APREQ_MINOR_VERSION       0
   
   /** patch level */
  -#define APREQ_PATCH_VERSION      16
  +#define APREQ_PATCH_VERSION      17
   
   /** 
    *  This symbol is defined for internal, "development" copies of libapreq.
  
  
  

Mime
View raw message