Quick CGI question: doing nothing?

2007-03-27 Thread David Bovill

How do I create a CGI that does nothing - from searching around I came
across the 204 HTTP Response code. So my basic question is how do I write
cgi's to return different HTTP response codes?
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Quick CGI question: doing nothing?

2007-03-27 Thread Andre Garzia

David,

a nice read is HTTP Made Easy http://www.jmarshall.com/easy/http/

for a 204 response, just begin your response with

HTTP/1.0 204 my descriptive text

then put your headers, then your actual data...

Cheers
andre


On Mar 27, 2007, at 9:42 AM, David Bovill wrote:


How do I create a CGI that does nothing - from searching around I came
across the 204 HTTP Response code. So my basic question is how do I  
write

cgi's to return different HTTP response codes?
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Quick CGI question: doing nothing?

2007-03-27 Thread David Bovill

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

On 27/03/07, Andre Garzia [EMAIL PROTECTED] wrote:


David,

a nice read is HTTP Made Easy http://www.jmarshall.com/easy/http/

for a 204 response, just begin your response with

HTTP/1.0 204 my descriptive text

then put your headers, then your actual data...

Cheers
andre


On Mar 27, 2007, at 9:42 AM, David Bovill wrote:

 How do I create a CGI that does nothing - from searching around I came
 across the 204 HTTP Response code. So my basic question is how do I
 write
 cgi's to return different HTTP response codes?
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Quick CGI question: doing nothing?

2007-03-27 Thread Andre Garzia

David,

you forgot the CRLF after the first line :-)

Andre

On Mar 27, 2007, at 10:17 AM, 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

On 27/03/07, Andre Garzia [EMAIL PROTECTED] wrote:


David,

a nice read is HTTP Made Easy http://www.jmarshall.com/easy/http/

for a 204 response, just begin your response with

HTTP/1.0 204 my descriptive text

then put your headers, then your actual data...

Cheers
andre


On Mar 27, 2007, at 9:42 AM, David Bovill wrote:

 How do I create a CGI that does nothing - from searching around  
I came

 across the 204 HTTP Response code. So my basic question is how do I
 write
 cgi's to return different HTTP response codes?
 ___
 use-revolution mailing list
 use-revolution@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-revolution

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your  
subscription preferences:

http://lists.runrev.com/mailman/listinfo/use-revolution


___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Quick CGI question: doing nothing?

2007-03-27 Thread Dave Cragg


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


David, try this:

 put Status: 204 my descriptive text  cr
 put Content-Type: text/html  CR
 put Content-Length:  length(buffer)  cr  cr
  -- write buffer to stdout

Cheers
Dave
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Quick CGI question: doing nothing?

2007-03-27 Thread Dave Cragg


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




___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Quick CGI question: doing nothing?

2007-03-27 Thread David Bovill

OK - thanks guys that fixed it:

on startup
  put Hello world! into buffer

  -- put HTTP/1.0 204 my descriptive text  crlf
  put Status: 204 my descriptive text  CR
  put Content-Type: text/html  CR
  put Content-Length:  length(buffer)  crlf  crlf
  put buffer
  quit
end startup

I guess the Status: part of the header applies to other status responses?

NB - is there a rhyme and a reason to when to use CR and when CRLF - it
seems pretty well interchangeable on a Linux server, are there any buts?
Sam goes with using write buffer to stdout or just put buffer - any
actual differences?
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Quick CGI question: doing nothing?

2007-03-27 Thread Dave Cragg


On 27 Mar 2007, at 15:00, David Bovill wrote:
NB - is there a rhyme and a reason to when to use CR and when CRLF  
- it
seems pretty well interchangeable on a Linux server, are there any  
buts?
Sam goes with using write buffer to stdout or just put buffer -  
any

actual differences?


The http spec calls for crlf, but it seems Apache is very nice and  
changes from cr to crlf when sending the response to the client.  I  
don't think all servers do this.


If in doubt, I'd suggest using crlf.

Cheers
Dave
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Quick CGI question: doing nothing?

2007-03-27 Thread J. Landman Gay

Dave Cragg wrote:


On 27 Mar 2007, at 15:00, David Bovill wrote:

NB - is there a rhyme and a reason to when to use CR and when CRLF - it
seems pretty well interchangeable on a Linux server, are there any 
buts?

Sam goes with using write buffer to stdout or just put buffer - any
actual differences?


The http spec calls for crlf, but it seems Apache is very nice and 
changes from cr to crlf when sending the response to the client.  I 
don't think all servers do this.


Actually, I think it is Rev that does this, just as it changes line 
endings in imported text files and across platforms in stacks.


I've never used anything but cr, and it always works.

--
Jacqueline Landman Gay | [EMAIL PROTECTED]
HyperActive Software   | http://www.hyperactivesw.com
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution