[REBOL] CGI Error Re:
Louis wrote: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Is your script printing a Content-type header as the first thing it does, followed by a blank line? print "Content-type: text/html^/^/" Kev Kevin McKinnon, Network Engineer [EMAIL PROTECTED] Sunshine Communications http://www.sunshinecable.com PGP Public Key: http://www.dockmaster.net/pgp.html PGP 6.0 www.pgp.com
[REBOL] CGI Error Re:
I should have mentioned that I am trying to get the cgiemailer.r script from rebol.com to work. I haven't changed anything except the path in cgiemailer.html. Louis At 06:23 PM 5/17/00 -0500, you wrote: I'm having trouble getting set up. What is causing the following error message? Is it caused by me or my ISP? Many thanks in advance. Louis CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
[REBOL] CGI Error Re:(2)
Kev, My last post was directed to you, but I forgot to put your name on it. Sorry. Thanks for the help. Louis At 04:07 PM 5/17/00 -0700, you wrote: Louis wrote: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Is your script printing a Content-type header as the first thing it does, followed by a blank line? print "Content-type: text/html^/^/" Kev Kevin McKinnon, Network Engineer [EMAIL PROTECTED] Sunshine Communications http://www.sunshinecable.com PGP Public Key: http://www.dockmaster.net/pgp.html PGP 6.0 www.pgp.com
[REBOL] CGI Error Re:(2)
Here's the script: #!rebol -cs REBOL [ Title: "Sends Email via CGI Form" Date: 20-July-1999 File: %cgiemailer.r Purpose: { Uses a Web form to send an email message. } ] print "Content-Type: text/html^/^/" ;-- Required Page Header print "htmlbodyh2Results:/h2" cgi: make system/standard/email decode-cgi system/options/cgi/query-string either all [ email? try [cgi/to: load cgi/to] email? try [cgi/from: load cgi/from] ][ print [B "Sending Email to" cgi/to /B] send/header cgi/to cgi/content cgi ][ print "BInvalid email to or from address/B" ] print "/bodyhtml" And here is the HTML: HTML HEAD META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1" TITLEuntitled/TITLE /HEAD BODY BGCOLOR="white" FORM ACTION="http://worldmerchantltd.com/www/cgi-bin/cgiemailer.r" METHOD="GET" H2FONT FACE="Arial, Helvetica"Send an Email Message:/FONT/H2 P TABLE BORDER="1" CELLSPACING="1" WIDTH="75%" BGCOLOR="silver" TR TD WIDTH="9%" BGCOLOR="#3C6F99" P ALIGN="RIGHT"BFONT COLOR="white"To:/FONT/B /TD TDINPUT TYPE="TEXT" NAME="to" SIZE="40"/TD /TR TR TD WIDTH="9%" BGCOLOR="#3C6F99" P ALIGN="RIGHT"BFONT COLOR="white"From:/FONT/B /TD TDINPUT TYPE="TEXT" NAME="from" SIZE="40"/TD /TR TR TD WIDTH="9%" BGCOLOR="#3C6F99" P ALIGN="RIGHT"BFONT COLOR="white"Subject:/FONT/B /TD TDINPUT TYPE="TEXT" NAME="subject" SIZE="40"/TD /TR TR TD WIDTH="9%" BGCOLOR="#3C6F99" P ALIGN="RIGHT"BFONT COLOR="white"Message:/FONT/B /TD TDTEXTAREA NAME="content" ROWS="10" COLS="40"/TEXTAREA/TD /TR /TABLE /P PINPUT TYPE="SUBMIT" NAME="Submit" VALUE="Send Message" /FORM /BODY /HTML At 04:07 PM 5/17/00 -0700, you wrote: Louis wrote: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Is your script printing a Content-type header as the first thing it does, followed by a blank line? print "Content-type: text/html^/^/" Kev Kevin McKinnon, Network Engineer [EMAIL PROTECTED] Sunshine Communications http://www.sunshinecable.com PGP Public Key: http://www.dockmaster.net/pgp.html PGP 6.0 www.pgp.com
[REBOL] CGI Error Re:
Hi Louis, you wrote: I'm having trouble getting set up. What is causing the following error message? I it caused by me or my ISP? Many thanks in advance. Louis CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: If this is the complete error message, then the Content-type: text/html is not being reported. Provided that your script does print the string Content-type: text/html before it outputs anything else, at least that string should appear in the reported headers. If the first thing being printed by your script is the Content-type ... thing, and the error you report is the complete text of the error reported by your ISP, then at least something is wrong with their error reporting mechanism. 1. Perhaps their error reporting mechanism has a bug and is suppressing the Content-type header? 2. Or their bug is that they are missing the Content-type header you are printing, and therefore they report that they did not receive any headers? 3. Perhaps they should not be displaying an error at all? 4. Perhaps something is wrong with your configuration on their machine and therefore the Content-type header you are printing is not reported to them? Do you happen to know their configuration? What OS are they using? Webserver? ;- Elan [: - )]
[REBOL] CGI Error Re:(3)
Hi Louis, a little off-topic, but it is more efficient to collect your output in a string and print the complete string in one go, using a single call to print. Like so: output: make string! 1000 insert output {Content-Type: text/html^/^/ htmlbodyh2Results:/h2} cgi: make system/standard/email decode-cgi system/options/cgi/query-string either all [ email? try [cgi/to: load cgi/to] email? try [cgi/from: load cgi/from] ][ append output "B Sending Email to cgi/to /B" send/header cgi/to cgi/content cgi ][ append output "BInvalid email to or from address/B" ] print [output "/bodyhtml"] At 07:32 PM 5/17/00 -0500, you wrote: Here's the script: #!rebol -cs REBOL [ Title: "Sends Email via CGI Form" Date: 20-July-1999 File: %cgiemailer.r Purpose: { Uses a Web form to send an email message. } ] print "Content-Type: text/html^/^/" ;-- Required Page Header print "htmlbodyh2Results:/h2" cgi: make system/standard/email decode-cgi system/options/cgi/query-string either all [ email? try [cgi/to: load cgi/to] email? try [cgi/from: load cgi/from] ][ print [B "Sending Email to" cgi/to /B] send/header cgi/to cgi/content cgi ][ print "BInvalid email to or from address/B" ] print "/bodyhtml" And here is the HTML: HTML HEAD META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1" TITLEuntitled/TITLE /HEAD BODY BGCOLOR="white" FORM ACTION="http://worldmerchantltd.com/www/cgi-bin/cgiemailer.r" METHOD="GET" H2FONT FACE="Arial, Helvetica"Send an Email Message:/FONT/H2 P TABLE BORDER="1" CELLSPACING="1" WIDTH="75%" BGCOLOR="silver" TR TD WIDTH="9%" BGCOLOR="#3C6F99" P ALIGN="RIGHT"BFONT COLOR="white"To:/FONT/B /TD TDINPUT TYPE="TEXT" NAME="to" SIZE="40"/TD /TR TR TD WIDTH="9%" BGCOLOR="#3C6F99" P ALIGN="RIGHT"BFONT COLOR="white"From:/FONT/B /TD TDINPUT TYPE="TEXT" NAME="from" SIZE="40"/TD /TR TR TD WIDTH="9%" BGCOLOR="#3C6F99" P ALIGN="RIGHT"BFONT COLOR="white"Subject:/FONT/B /TD TDINPUT TYPE="TEXT" NAME="subject" SIZE="40"/TD /TR TR TD WIDTH="9%" BGCOLOR="#3C6F99" P ALIGN="RIGHT"BFONT COLOR="white"Message:/FONT/B /TD TDTEXTAREA NAME="content" ROWS="10" COLS="40"/TEXTAREA/TD /TR /TABLE /P PINPUT TYPE="SUBMIT" NAME="Submit" VALUE="Send Message" /FORM /BODY /HTML At 04:07 PM 5/17/00 -0700, you wrote: Louis wrote: CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: Is your script printing a Content-type header as the first thing it does, followed by a blank line? print "Content-type: text/html^/^/" Kev Kevin McKinnon, Network Engineer [EMAIL PROTECTED] Sunshine Communications http://www.sunshinecable.com PGP Public Key: http://www.dockmaster.net/pgp.html PGP 6.0 www.pgp.com ;- Elan [: - )]
[REBOL] CGI Error Re:(3)
print "/bodyhtml" This should be /html - but that would not have caused the error you reported. Here's a generic email script that I've been using. The form uses the same variable names you see here (TO, FROM, SUBJECT). Note that you can add variables in the form, and REBOL will automatically be appended them to the content. The thing I've been meaning to add is a way to redirect the user to a confirmation page from the HTML form. -- #!/usr/bin/rebol --cgi REBOL[Title: "Contact CGI" ] ;- Configure Internet Mail, if necessary ; set-net [ ] ;- Create object based on system/standard/email with usual defaults. ;- (!) Added FROM_NAME for personal name email-obj!: make object! [ TO: none CC: none BCC: none FROM: none FROM_NAME: none REPLY-TO: none DATE: none SUBJECT: none RETURN-PATH: none ORGANIZATION: "" MESSAGE-ID: none COMMENT: none X-REBOL: {2.2.0.3.1 "The Internet Messaging Language (TM) WWW.REBOL.COM"} MIME-VERSION: none CONTENT-TYPE: none CONTENT: none ] ;- Retrieve HTML form variables from either CGI Environment or Standard Input email-obj: make email-obj! decode-cgi either system/options/cgi/request-method = "GET" [system/options/cgi/query-string] [make string! input] ;- Tweak email object set in email-obj 'FROM to-string join email-obj/FROM_NAME [" " email-obj/FROM ""] set in email-obj 'REPLY-TO email-obj/FROM set in email-obj 'SUBJECT join "[CONTACT] " email-obj/SUBJECT ;- (!) Work around bug in send - skips first line of CONTENT thinking it's the SUBJECT set in email-obj 'CONTENT join email-obj/SUBJECT [crlf email-obj/CONTENT] ;- Send it - Message is in email-obj send/header to-email email-obj/TO "" email-obj ;- Confirm it print {Content-Type: text/html !DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN" html head !-- base href="" -- titleContact Confirmed/title body p align=centerThank you for contacting us./p /body /html } ;- END OF PRINT ;- Done quit -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 425-0252; Fax 716 223-2506. -- http://www.husted.com/