Alert: Reading stdIn from POST in CGI's

Sivakatirswami katir at
Sat Jul 9 17:25:28 EDT 2005

just and FYI alert: I'm pretty sure I have confirmed an old bug (once  
again) in revolution CGI  read stnIn from a POST returns empty.  
Newbies could get easily burned on this one if they didn't see this  
discussion recently.

Be sure to *always* use the form.

on startup


     put "" into PostIn
     repeat until length(PostIn) >= $CONTENT_LENGTH
         read from stdin until ""
             put it after PostIn
       end repeat
     put  urlDecode (PostIn)  into tDataIn

     split tDataIn by "&" and "="
     put keys(tDataIn) into tFields

# where you use the $CONTENT_LENGTH to force reads on a repeat loop.

The following

on startup
    read from stdin until empty
    put  urlDecode (it)  into tDataIn
    split tDataIn by "&" and "="

is guaranteed to fail, but only intermittently.  Symptom... no data  
at all passed to variable "it", even on a post with a trivial amt of  
data (name address, ph# and CC#). It does not seem to have anythng to  
do at all with

a) traffic
b) concurrent hits
c) amt of data posted

i.e. even a simple 3 name-value pair set:


can be posted and the read from stdIn fails. try again.. it works...  
try again, it works, try again, it fails...


More information about the Use-livecode mailing list