Using old RunRev 2.x CGI scripts on LiveCode Community Serve

Are you using LiveCode to create server scripts or CGIs?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Stryder
Posts: 36
Joined: Fri Jul 21, 2006 12:05 pm

Using old RunRev 2.x CGI scripts on LiveCode Community Serve

Post by Stryder » Sun Jun 30, 2013 2:26 pm

I have a complete website running the old Revolution 2.x on Debian Linux from many moons ago. It has served well.

I've run into a problem, though. I've upgraded one of my servers to Debian 7 on a quad core Xeon processor, and I seem to have discovered a bug in this old version of Revolution that I hope is fixed in the newest iteration. I have text files that act as .cgi for the website.

Each text file contains:

#!revolution
on startup

Code: Select all

     put "Content-Type: text/html"&cr&cr&"<HTML><BODY>"&cr& [*RETURNED RESULT FROM CGI DISPLAYED AS HTML*]
end startup

The scripts function very well, except that if the cgi is returning too much data to the client browser, it gets truncated at the end.  I first thought this flaw was just a glitch with my code, but after upgrading my server again to a much faster machine, I noticed that it truncates MORE.  Which leads me to believe that this old engine quits before finishing serving all of the data through Apache.

I discovered the problem when I first upgraded computer components 3 years ago to faster processors.  It's even more apparent now, affecting significantly more scripts.

I want to try the newest LiveCode Community Server on my site, to see if it solves the problem.  The only issue is that it doesn't seem to work!

I've replaced the code at the top and bottom to the example on the LiveCode Server tutorial, as:

<?lc
   [code here]
     put "Content-Type: text/html"&cr&cr&"<HTML><BODY>Hello world!</HTML>"&cr
?>

However, I'm getting:

==============
[Sun Jun 30 08:05:43 2013] [error] (8)Exec format error: exec of 'betasite/test.cgi' failed
[Sun Jun 30 08:05:43 2013] [error] [client 142.x.x.110] Premature end of script headers: test.cgi
livecode-server exited due to fatal signal 11
  in __kernel_sigreturn @ 0
  in <unknown> @ 0x8087fa8
  in <unknown> @ 0x8081d11
  in <unknown> @ 0x80823cb
  in __libc_start_main @ 229
  in fwrite @ 329
[Sun Jun 30 08:06:06 2013] [error] [client 142.x.x.110] Premature end of script headers: test.cgi
===============

Should CGI script files have a different header/footer?  I can execute the script in the shell successfully, but through CGI it won't!  I'm hoping that the latest versions of LiveCode Server fix my data truncation problem (since my version of Revolution is from over 7 years ago!)

Stryder

Siddhanathaswami
Posts: 2
Joined: Fri Sep 05, 2014 2:52 am

Re: Using old RunRev 2.x CGI scripts on LiveCode Community S

Post by Siddhanathaswami » Sun Nov 30, 2014 11:44 pm

I've converted CGIs from Rev to Livecode. I had to use the "header" command to return headers instead of just putting it:
put header "Content-Type: text/html"&cr&cr&"<HTML><BODY>"&cr& [*RETURNED RESULT FROM CGI DISPLAYED AS HTML*]

Be sure not to put a "& cr" at the end of the put header or it worn't work (that was painful to figure out).

Post Reply

Return to “CGIs and the Server”