[libapreq2] Should there be two temp (spool) files?

[libapreq2] Should there be two temp (spool) files?

am 24.09.2008 20:03:53 von Ryan Gies

When I post a multipart-form request I see two files being written
in my temp directory:

-rw------- 1 ryan users 8318656 2008-09-24 10:51 apreqK5Oiyc
-rw------- 1 ryan users 8318484 2008-09-24 10:51 apreqQ1qs6C

And:

Apache2::Request->new($r)->upload('file')->tempname()

indicates the spool file is "apreqQ1qs6C".

So I wonder what the file "apreqK5Oiyc" is all about. I imagine it is
used to verify the bytes written and is just standard operating
procedure, but I want to ensure I have not created this situation.

Thanks and Cheers,
-Ryan

Re: [libapreq2] Should there be two temp (spool) files?

am 24.09.2008 20:08:24 von Joe Schaefer

--- On Wed, 9/24/08, Ryan Gies wrote:

> When I post a multipart-form request I see two files being
> written
> in my temp directory:
>
> -rw------- 1 ryan users 8318656 2008-09-24 10:51
> apreqK5Oiyc
> -rw------- 1 ryan users 8318484 2008-09-24 10:51
> apreqQ1qs6C
>
> And:
>
>
> Apache2::Request->new($r)->upload('file')->tempname()
>
> indicates the spool file is "apreqQ1qs6C".
>
> So I wonder what the file "apreqK5Oiyc" is all
> about.

It's spooling the contents of the raw (unparsed) body.
You can tell apreq not to do this by calling $r->discard_request_body
in your handler after invoking Apache2::Request::new.

Re: [libapreq2] Should there be two temp (spool) files?

am 24.09.2008 21:00:31 von Ryan Gies

On Wed, 24 Sep 2008 11:08:24 -0700 (PDT)
Joe wrote:

> It's spooling the contents of the raw (unparsed) body.
> You can tell apreq not to do this by calling $r->discard_request_body
> in your handler after invoking Apache2::Request::new.

When discarding the request body, I receive the error:

End of file found

(which happens when APR_BUCKET_IS_EOS). I can see the spool file being
written and *presume* the multi-part boundary is missing. In a
PerlHeaderParserHandler I am executing:

1) Apache2::Request->new()
2) $r->add_input_filter()
3) $r->discard_request_body()

Swapping steps 2 & 3 will yield same error. If calling
$r->discard_request_body() like this is not commonly known to work maybe
I should follow-up with the libapreq2 development list? If this is
known to work then obviously I need to isolate error.

Re: [libapreq2] Should there be two temp (spool) files?

am 24.09.2008 21:07:23 von Joe Schaefer

--- On Wed, 9/24/08, Ryan Gies wrote:

> When discarding the request body, I receive the error:
>
> End of file found
>
> (which happens when APR_BUCKET_IS_EOS). I can see the
> spool file being
> written and *presume* the multi-part boundary is missing.
> In a
> PerlHeaderParserHandler I am executing:
>
> 1) Apache2::Request->new()
> 2) $r->add_input_filter()
> 3) $r->discard_request_body()

Why are you doing step 2? You shouldn't need to add an
input filter for apreq to work.

> Swapping steps 2 & 3 will yield same error.

> If calling
> $r->discard_request_body() like this is not commonly
> known to work maybe
> I should follow-up with the libapreq2 development list? If
> this is
> known to work then obviously I need to isolate error.

It's known to work for a few people, but it's not the default
behavior. If you can't decipher why it's not working for you
then asking on apreq-dev@ makes sense.

Re: [libapreq2] Should there be two temp (spool) files?

am 24.09.2008 21:18:58 von Ryan Gies

On Wed, 24 Sep 2008 12:07:23 -0700 (PDT)
Joe wrote:

> > 1) Apache2::Request->new()
> > 2) $r->add_input_filter()
> > 3) $r->discard_request_body()
>
> Why are you doing step 2? You shouldn't need to add an
> input filter for apreq to work.

Step 2 is Apache2::UploadProgress::track_progress

> It's known to work for a few people, but it's not the default
> behavior. If you can't decipher why it's not working for you
> then asking on apreq-dev@ makes sense.

I will try to reproduce the issue with a simple test case and follow up
there if necessary. Thank you.