Re: how to get the temp file name

Issac Goldstand <[email protected]>
Newsgroups gmane.comp.apache.apreq
Message-ID <[email protected]>
I'm not sure I understand what you're trying to accomplish.  If the
parse fails, why do you need the temp filename?

Brian McQueen wrote:
> Better still I passed in the request_record as the context and saved
> the information in the per request config structure for the module:
>
> apreq_hook_t * my_hook_handle = apreq_hook_make(req->pool,
>> my_hook, NULL, req);
>
> With this technique I have access to the data even after an
> interruption causing an EOF is received.  The data hangs around until
> the request is completed, so I can recover from the interruption.
>
> I would like to have this hook remove itself once it sets the value.
> How do I remove it?  I see no function for removal of a hook.  Would I
> have to step through the hook_queue, find the one that matches the
> current hook, and then move the rest of them up a slot?  That sounds a
> bit messy.
>
> On 9/12/06, Brian McQueen <[email protected]> wrote:
>> That does work, but it won't get me where I need to be.  The problem
>> is that the spoolfile isn't set after a parsing error - there is no
>> brigade in param->upload upon a bad parse.  I did find a simple way to
>> get a filter in there:
>>
>>     apreq_hook_t * my_hook_handle = apreq_hook_make(req->pool,
>> my_hook, NULL, NULL);
>>     apreq_hook_add(aph, my_hook_handle);
>>
>> I think I'll be able to set a note with this technique.
>>
>> Brian McQueen
>>
>> On 9/12/06, Issac Goldstand <[email protected]> wrote:
>> > Well, the spool file is just a normal apr_file_t, and the actual file
>> > handle is accessable via apreq_brigade_spoolfile(), so you'll likely
>> > want to do something like:
>> >
>> > (untested)
>> > char[255] filename;
>> > apr_status_t rv;
>> >
>> > rv = apr_file_name_get(&filename,
>> apreq_brigade_spoolfile(param->upload));
>> >
>> >   Issac
>> >
>> > Brian McQueen wrote:
>> > > I am trying to figure out how to get the name of the temp file
>> created
>> > > by apreq when it spools to the disk.  I have been through several
>> > > tries now and the most promising seems to be making a hook and
>> adding
>> > > it to the parser.  The hook would get the name from the brigade
>> as the
>> > > request is parsed, then it could put the name into a note which my
>> > > module could get later.  I'm struggling now to add my hook to the
>> > > parser.  I have a parser function, but not a parser_t at that
>> stage of
>> > > my code - prior to reading and parsing - and the add_hook function
>> > > requires a parser_t.   At this stage the parser is not yet set.
>> > >
>> > > How can I directly add a hook to the parse_multipart parser?
>> > > Do any of you have any better ideas?
>> > >
>> > > Brian McQueen
>> >
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.