On Tue, May 01, 2001 at 03:41:50PM -0500, William A. Rowe, Jr. wrote:
> From: "Bill Stoddard" <[EMAIL PROTECTED]>
> Sent: Tuesday, May 01, 2001 11:56 AM
> 
> > Why can't we just cache the open file descriptor (not apr_file_t, 
> > but the actual descriptor) then build a bucket out of the request 
> > pool (just as if we opend the file as part of the request
> > processing)?
> 
> What file descriptor?  This is the wrong way to go, IMHO.  We invented
> apr_file_t's for a reason.  Provide a way to 'realloc/copy' an apr_t
> entity into another pool (different lifetime) portably, don't go assuming
> stuff.  On win32, we MUST know if the file handle was opened normally,
> or for overlapped IO (no current file position) access.

We already have it. It's called apr_file_dup().

Keep the apr_file_t open and in the cache. When you want to deliver it, do
the following:

  status = apr_file_dup(&new_file, cached_file, r->pool);
  bucket = apr_bucket_file_create(new_file);
  ...

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Reply via email to