Quick CGI question: doing nothing?

Dave Cragg dave.cragg at lacscentre.co.uk
Tue Mar 27 09:39:32 EDT 2007


On 27 Mar 2007, at 14:17, David Bovill wrote:

> Thanks Andre, I have tried a bunch of variations and think I must  
> be making
> a basic error as I am getting nothing but "Internal server errors".  
> What's
> wrong with this script:
>
> on startup
>   put "Do nothing" into buffer
>   -- put "HTTP/1.1 204" && buffer & crlf & crlf
>
>   put "HTTP/1.0 204 my descriptive text"
>   put "Content-Type: text/html" & CR
>   put "Content-Length: "& length(buffer) & crlf & crlf
>   -- write buffer to stdout
>
>   quit
> end startup

Looking again at your original question, you shouldn't use the 204  
response if you are returning any data. In other words, don't write  
anything after the headers:

put "Status: 204 my descriptive text" & cr
put "Content-Type: text/html" & cr & cr

You can achieve basically the same thing with a standard 200 response  
and a Content-length header of zero.

Cheers
Dave







More information about the use-livecode mailing list