Nicolas Cueto wrote: > > Hi, > > The mt script below (Linux/Apache/MC2.3) successfully reads and return html > form-data only when the form-data is short (less than 2-3 paragraphs). When > the data is too long, a combination of several erratic behaviours can > happen: > > (1) data is read in and saved integrally into two files, but is returned > truncated > (2) data is neither saved into the files nor returned to the browser (i.e., > the mt-generated page is returned, but data is missing from the textarea > form-objects) > (3) like (2), except the returned page appears "mutilated" (i.e., snippets > of html coding appear in the places where the missing textarea form-objects > ought to be) > (4) data is not saved into the files, and a completely blank page is > returned > > I checked the archives, especially Scott Raney's advice in > http://www.mail-archive.com/[email protected]/msg03228.html that: > > > The actual buffer size depends on the version of UNIX > > and even on what type of descriptor is being written to > > and what the two ends are connected to. And the > > amount you'll get in a given "read until empty"also > > depends on CPU scheduling and how the process on the > > other end wrote it out. But none of this should matter > > if you do the reads correctly. > > Did I do the reads correctly? > > Thank you. > > Nicolas R Cueto > > %%%%%%% here's that script %%%%%%%%%%%%%%%%%%% > > #!mc > on startup > if $REQUEST_METHOD is "POST" then > read from stdin until eof -- I also tried "until empty"
There is no eof I don't think in the HTTP environment and "empty" can be anywhere. You have to be more precise: you know there is crlf & crlf between the header and the body so you read until you reach that point then you must look in what you read (the header) for the "Content Length:..." line (which your client *must* provide) and read for that length. > put it into buffer -- do I need this line? Buffer is just the name of a variable. > set the itemDel to "&" > put item 1 of it into tRawData1 > put item 2 of it into tRawData2 > put urlDecode(tRawData1) into tData1 > put urlDecode(tRawData2) into tData2 > put tData1 into url "file:data1.txt" > put tData2 into url "file:data2.txt" > ## write out HTTP headers here ## > put "Content-Type: text/html" & crlf > put "Content-Length:" && the length of buffer & crlf & crlf > ## write the html file ## > -- a bunch of html here. Essentially a 3x2 table, > -- with 2 text area form objects into which > -- tData1 & tData2 are "put" > end if > end startup > > Archives: http://www.mail-archive.com/[email protected]/ > Info: http://www.xworlds.com/metacard/mailinglist.htm > Please send bug reports to <[EMAIL PROTECTED]>, not this list. Andu Archives: http://www.mail-archive.com/[email protected]/ Info: http://www.xworlds.com/metacard/mailinglist.htm Please send bug reports to <[EMAIL PROTECTED]>, not this list.
