Re: [mp1] post2get and multipart/form-data

[prev] [thread] [next] [Date index for 2005/05/08]

From: Stas Bekman
Subject: Re: [mp1] post2get and multipart/form-data
Date: 04:08 on 08 May 2005
Frank Maas wrote:
> Hi Stas,
> 
> Thanks for responding.
> 
> 
>>>this work I convert POST requests to GET requests (so the parameters are
>>>not lost, based on a Geoff-example) and make sure that they get populated 
>>>to the subrequest (via a transhandler). This works... worked :-(
>>
>>what has changed since it was working?
> 
> 
> What changed was the way CGI.pm is working. Since some version in the
> history it started to use XHTML as default and with it Lincoln changed
> the default encoding to multipart/form-data. As I said, this behaviour
> can be changed, but that mechanism does not co-operate reliably with
> mod_perl. Anyhow, I gather that wanting to support uploads kind of makes
> it necessary to use multipart posts.

If CGI.pm has broken backwards compatibility, it's not a good thing. It 
should probably provide some flag to enable it. (Or may be the move to 3.0 
was intentional to allow new functionality, in which case, just continue 
using the latest CGI.pm in the 2.x series.

>>>I try to avoid using it because (a) it is heavy (is it?),
>>
>>you must be kidding, Frank. libapreq heavy? it's much lighter and faster 
>>than CGI.pm, check the benchmarks:
> 
> 
> Yep, sorry - didn't mean it lik that. I compared using APR to not using

APR is totally different thing, accessible only from mp2, you must have 
meant libapreq or Apache::Request.

> it at all. When I use CGI I do this because I "like" the way it handles 
> forms and allows me to perl-code HTML. It is possible however that I 
> turn away from CGI.pm as well though.

You can still use CGI.pm to produce output. And in libapreq2 (requires 
apache2), you will be able to re-use data, so you won't need to do any 
workarounds.

BTW, If you have further questions re: libapreq it's the best to send 
those to the libapreq dev mailing list.

>>>(b) it eats POST data in a way that CGI can no longer handle it properly, 
>>
>>right, which is why you should move to Apache2, where it doesn't happen.
>>
>>(c) if I want to change to Apache2 every usage of APR must be rechecked.
>>what do you mean?
> 
> 
> Combining the two: the last time I looked into using Apache2 was more than 
> half a year ago. At that time there was no Apache::Request and, contrary 
> to what you might deduce from my writing above, I use(d) it in rather a 
> lot of places. Oh and... I have your (and co-author)  Practical Guide to 
> mod_perl and Geoffs (and co-author) Cookbook, use those rather heavily and 
> lack good books on mp2. So perhaps I am also a bit afraid of the dark...

We will see, may be some mp2 docs will be published. For now mp2 has an 
extensive docs at: http://perl.apache.org/docs/2.0/index.html
and I believe so does libapreq, not sure if they are online.

> BTW - while speaking to you on this subject ;-): while searching for this 
> issue I found, on the perl.apache.org website 
> (http://perl.apache.org/docs/1.0/guide/snippets.html#Reusing_Data_from_POST_request)
> the text "But what do we do with large multipart file uploads? [...]
> switch the request method from POST to GET, and store the POST data 
> in the query string. This handler does exactly this:"
> AFAIK now this is incorrect. Seen the rest of the text, it should better 
> read:
> 
> "As long as you do not use multipart/form-data encoded POSTs (like with
> file uploads) you can also alter the request. A transparent..."
> 
> Do you agree? To whom and how should I send such a correction?

Hmm, it's been years since I've last used this code. As it's written, it's 
supposed to be the solution for the multipart encoded POSTs. You are 
suggesting the opposite. So why is it needed at all then?


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

[mp1] post2get and multipart/form-data
Frank Maas 12:54 on 06 May 2005

Re: [mp1] post2get and multipart/form-data
Stas Bekman 07:02 on 07 May 2005

Re: [mp1] post2get and multipart/form-data
Frank Maas 22:16 on 07 May 2005

Re: [mp1] post2get and multipart/form-data
Stas Bekman 04:08 on 08 May 2005

Generated at 06:57 on 17 May 2005 by mariachi v0.52