Hi All...
I'm going through and taking a closer look at the cgi capabilities of rev. I'm using the HyperActiveSoftware tutorial.
Everything works great just as described, until I get to the part about using the stacks as libraries with CGIs.
I'm getting the following error:
The server encountered an internal error and was unable to complete your request.
Error message:
Premature end of script headers: addressSearch.cgi
If you think this is a server error, please contact the webmaster.
Error 500
I have followed the tutorial multiple times and I'm still not successful.
This is running on and OS X Server (Intel) running 10.5.3.
Any suggestions for what I might try?
Thank you!
HyperActive CGI Tutorial - address stack example?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 9837
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
It may be that the script file was written on a Mac or PC, and doesn't have UNIX line endings.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 1236
- Joined: Sat Apr 08, 2006 1:10 pm
- Location: Zurich
- Contact:
Make sure to close the stack, or include "quit" as the last line of your cgi script. Newer Rev CGI engines will not terminate properly if stacks are still open when your script finishes, and apache will terminate it forcefully, resulting in a 400 error.
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
A little closer but still not there
The Rev CGIs work with the first three examples on the HyperActiveSW.
However, when trying to use the example with the stack addressbook, it's still a no go.
I know the first part of the addressSearch.cgi is running, becomes the browser complains about not finding the data stack.
I thought I may have figured it out, I remembered with SuperCard we had to give the full address, not the web address, to the stack. But that wasn't it either.
The cgi script I'm using is by Jacqueline <http://www.hyperactivesw.com/cgitutorial/scripts3.html>
#!revolution
on startup
put $QUERY_STRING into theTerms
put "" into buffer
put "addresses.rev" into theStack
if theTerms = "" then
put "No query submitted." after buffer
else if there is no stack theStack then
put "Data stack cannot be found." after buffer
else
start using stack theStack
set the defaultstack to theStack
put 0 into theCt
put theTerms into theTermsArray
split theTermsArray by "&" and "="
put urlDecode(theTermsArray["terms"]) into theSearchWords
put urlDecode(theTermsArray["searchScope"]) into theScope
unmark all cds
if theScope = "byfield" then
delete char 1 to offset("&Fields",theTerms) of theTerms
replace "Fields=" with empty in theTerms
replace "&" with comma in theTerms
put theTerms into theFldList
repeat for each item i in theFldList
mark cds by finding theSearchWords in fld i
end repeat
else -- find in all flds
mark cds by finding theSearchWords
end if
repeat with x = 1 to the number of marked cds
put fld "name" of marked cd x & "<br>" & cr after buffer
put fld "address" of marked cd x & "<br>" & cr after buffer
put fld "city" of marked cd x && \
fld "state" of marked cd x && \
fld "zip" of marked cd x & "<br>" & cr after buffer
put fld "phone" of marked cd x & "<p>" & cr after buffer
add 1 to theCt
end repeat
stop using stack theStack
end if
put "<h3>Results for " "e& theSearchWords "e& colon \
& "</h3>"& theCt && "found" && "<p>" before buffer
put "</body> </html>" after buffer
put "Content-Type: text/html" & cr & cr
put buffer
--quit >also tried adding the quit at the end as was suggested, but did not seem to make a difference in the result
end startup
Other ideas?
Thank you!
The Rev CGIs work with the first three examples on the HyperActiveSW.
However, when trying to use the example with the stack addressbook, it's still a no go.
I know the first part of the addressSearch.cgi is running, becomes the browser complains about not finding the data stack.
I thought I may have figured it out, I remembered with SuperCard we had to give the full address, not the web address, to the stack. But that wasn't it either.
The cgi script I'm using is by Jacqueline <http://www.hyperactivesw.com/cgitutorial/scripts3.html>
#!revolution
on startup
put $QUERY_STRING into theTerms
put "" into buffer
put "addresses.rev" into theStack
if theTerms = "" then
put "No query submitted." after buffer
else if there is no stack theStack then
put "Data stack cannot be found." after buffer
else
start using stack theStack
set the defaultstack to theStack
put 0 into theCt
put theTerms into theTermsArray
split theTermsArray by "&" and "="
put urlDecode(theTermsArray["terms"]) into theSearchWords
put urlDecode(theTermsArray["searchScope"]) into theScope
unmark all cds
if theScope = "byfield" then
delete char 1 to offset("&Fields",theTerms) of theTerms
replace "Fields=" with empty in theTerms
replace "&" with comma in theTerms
put theTerms into theFldList
repeat for each item i in theFldList
mark cds by finding theSearchWords in fld i
end repeat
else -- find in all flds
mark cds by finding theSearchWords
end if
repeat with x = 1 to the number of marked cds
put fld "name" of marked cd x & "<br>" & cr after buffer
put fld "address" of marked cd x & "<br>" & cr after buffer
put fld "city" of marked cd x && \
fld "state" of marked cd x && \
fld "zip" of marked cd x & "<br>" & cr after buffer
put fld "phone" of marked cd x & "<p>" & cr after buffer
add 1 to theCt
end repeat
stop using stack theStack
end if
put "<h3>Results for " "e& theSearchWords "e& colon \
& "</h3>"& theCt && "found" && "<p>" before buffer
put "</body> </html>" after buffer
put "Content-Type: text/html" & cr & cr
put buffer
--quit >also tried adding the quit at the end as was suggested, but did not seem to make a difference in the result
end startup
Other ideas?
Thank you!