Nicolas Cueto wrote/ schreef:
> ..mt newbie here, running mc on a Linux/Apache home server...
>
> This mt script, when called over the internet thru a browser by an html
> form's submit button, successfully puts stdin into the specified file but
> the error logs show "premature end of script headers":
>
> #!mc
> on startup
> if $REQUEST_METHOD is "POST" then
> read from stdin until empty
> put it into url "file:rawdata.txt"
> end if
> end startup
>
> What am I doing wrong?
> [snip]
I don't know anything about Apache, but I guess the problem is that Apache
expects the cgi-script to output a legal set of headers. A cgi should output
something like:
-- start output --
Content-Type: text/plain
Content-Length: 5
Test.
-- end ouput --
So your script would be something like:
on startup
if $REQUEST_METHOD is "POST" then
read from stdin until empty
put it into url "file:rawdata.txt"
end if
-- put something to output in a variable here
put "This is a test." into outputBuffer
-- output the variable plus headers
put "Content-Type: text/plain" & cr
put "Content-Length:" && the length of outputBuffer & cr & cr
put outputBuffer
end startup
Note: put without an 'into' clause outputs to the stdout, that's exactly
what you want.
Hope this helps.
(If you want to output html, change 'text/plain' into 'text/html')
> Thank you in advance.
>
> Nicolas R Cueto
Regards, / Groeten,
Sjoerd
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.