You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Malcolm J Harwood <mj...@liminalflux.net> on 2006/10/05 04:32:31 UTC

Re: Getting post data

On Thursday 28 September 2006 04:03, Erik Norgaard wrote:

(I don't recall seeing a response to this, apologies if I'm duplicating).

> I am using Apache 2.2 with mod_perl2. Reading the documentation I have
> found that I should get POST data using read():
>
>    $r->read($buffer, $r->headers_in('content-length'))

Don't do that unless you really need to for some reason. (see below)

> A few questions - ok, some may really be related to the http protocol:
>
> 1) Is the headers_in case sensitive? (content-length ne Content-Length)?

I believe so.

> 2) Once in, any tricks or modules for parsing the data?

CGI.pm and libapreq both provide methods for getting the data, you don't read 
it yourself, you just ask the module for the data and it hands it to you 
pre-parsed.

> 3) How about file-uploads, are these binary or base64?

It doesn't matter, use one of the above and it'll handle it all for you and 
give you the data.

> 4) How do I efficiently handle large posts (such as file uploads)?

I believe libapreq is faster than CGI.pm, is that what you meant?

> I know I could bang my head against the keyboard and eventually get some
> working code out, but it seems that these are quite general issues, so
> some solution must exist.

Yup.

> Other question: modperlbook.org is down, is there a mirror or place I
> can download it?

It seems to be up now.