httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: apreq-2 uploads as bucket brigades?
Date Mon, 20 Jan 2003 00:01:17 GMT
Joe Schaefer wrote:
> Stas Bekman <stas@stason.org> writes:
> 
> 
>>Joe Schaefer wrote:
>>
>>>I'd like to drop the req->upload linked list of temp files,
>>>and use bucket brigades in their place.  I'd planning to 
>>>use a common apreq_param_t struct which extends apreq_value_t 
>>>like so:
>>>
>>>struct apreq_param_t {
>>>    enum { ASCII, UTF_8, UTF_16, IS0_LATIN_1 } charset;
>>>    char                *language;
>>>    apreq_table_t       *info;  /* mime headers */
>>>
>>>    apr_bucket_brigade  *bb;    /* represents file contents */
>>>
>>>    apreq_value_t        v;
>>>};
>>>
>>>
>>>The main advantage of this approach would be that we can use
>>>the full bucket api for managing the upload data.  The brigade
>>>could use heap-allocated buckets for smaller uploads, and then
>>>switch over to mmapped or file buckets after a certain size.
>>>The bucket API makes this look pretty easy.
>>
>>And you can even write upload hook filters with that ;)
>>
>>I agree that using a polished bb API, will make apreq's code more
>>robust, and may be shorter?
> 
> 
> Right.  Hopefully it'll make it easier to use apreq-2 within an
> asynchronous IO environment as well.
> 
> By the way, is there a TIEHANDLE API for bucket brigades in modperl 
> 2?  The core issue I'm concerned about is: what happens when an
> apreq-2 application wants to read the whole brigade, i.e.
> 
>   my $fh = $upload->fh; 
>   print while <$fh>;
>   
> ? The file-buckets within the brigade will start generating 
> heap-buckets.  It *must* be our job to manage those additional 
> heap-buckets, not the application programmer's job.  Perl's
> refcounts should work well for this, but that might mean we'd 
> end up pushing the "FILE API" into the Perl glue and out 
> of the apreq-2 core.

Look at the streaming filters API:
http://perl.apache.org/docs/2.0/user/handlers/filters.html#Stream_oriented_Output_Filter
These can be adopted to work with upload objects as well.

A complete TIEHANDLE is planned for filters (implemented only partially), 
and should be easy to re-use for file uploads as well.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message