You are reading the data correctly, but you need to check 
system/options/cgi/request-method to make sure that this was a POST request 
before you use the content-length - if the page was requested with GET you 
don't want to try to read from STDIN.  And if there is a POST request with 
no data it is an error, so and error responce is correct and does not need 
to be fixed, at most just checkk for it with "if error? try [ ... ]" and 
generate an error page.

As for the ugly problem, you could always build a wrapper function adn 
either include it in your programs, or in your %user.r

Cal Dixon  ([EMAIL PROTECTED])
-><-


>From: [EMAIL PROTECTED]
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: [REBOL] cgi and post
>Date: Sun, 20 Feb 2000 22:25:03 +0100
>
>
>  Hi.
>
>I wanna ask what's the latest recomended way to read data submitted
>from some www page with form by POST method.
>
>I use:
>
>   tmp: load system/options/cgi/content-length
>   buffer: make string! (tmp + 10)
>   read-io system/ports/input buffer tmp
>
>   ...
>   decode-cgi buffer
>
>
>
>but IMHO it's quite ugly.
>And when calling the cgi "manually" without any data submission,
>it throw an error (as excepted).
>Of course I can check if found? system/options/cgi/content-length
>but it is quaranteed that content-length will be send everytime
>by each browser (or another user-agent)? (question for Holger?)
>
>what about reading stdin by this way:
>
>instr: make string! 5 * 1024
>while [found? tmp: pick system/ports/input 1][append instr tmp]
>
>What are using You?
>
>Thanks.
>Jan
>
>--
>Jan Strejcek
>[EMAIL PROTECTED]
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

Reply via email to