CGI SOS

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
arthurrichards77
-


Joined: 22 Jun 2002
Posts: 2
Location: Boston MA

PostPosted: Sat Jun 22, 2002 11:55 pm    Post subject: CGI SOS Reply with quote

I'm writing my CGI version 1.0: "Hello World"

I've used Free Pascal (www.freepascal.org) to ensure I get a win32 executable (its definitely getting further than my attempts with DJGPP)

The server gives me 'Error 500 - Internal Server Error'
The cgi log is empty but the access log reads:
127.0.0.1 - - [22/Jun/2002:18:51:38 +1133] "GET /cgi-bin/hello.exe HTTP/1.0" 500 450

The code is below - even if you're not a Pascal user, I'm sure you can follow it. I've tested redirecting the output to a file and it gives me the text lines I'd expect.

Any suggestions please?

Arthur

program hello;

begin

writeln('Content-type: text/html');

writeln('<HTML><HEAD>');
writeln('<TITLE>output of HTML from CGI script</TITLE>');
writeln('</HEAD><BODY>');
writeln('<H1>Sample output</H1>');

writeln('Hello World');

writeln('</BODY></HTML>');

end.
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Sun Jun 23, 2002 2:24 pm    Post subject: Re: CGI SOS Reply with quote

arthurrichards77 wrote:
I'm writing my CGI version 1.0: "Hello World"

I've used Free Pascal (www.freepascal.org) to ensure I get a win32 executable (its definitely getting further than my attempts with DJGPP)

The server gives me 'Error 500 - Internal Server Error'
The cgi log is empty but the access log reads:
127.0.0.1 - - [22/Jun/2002:18:51:38 +1133] "GET /cgi-bin/hello.exe HTTP/1.0" 500 450

In CGI, the headers and the body must be separted by a blank line (a line with a carriage return only in it). So in your case, your code is missing another writeln after the first.
The code should be:
Code:

program hello;

begin

  writeln('Content-type: text/html');

  writeln;

  writeln('<HTML><HEAD>');
  writeln('<TITLE>output of HTML from CGI script</TITLE>');
  writeln('</HEAD><BODY>');
  writeln('<H1>Sample output</H1>');
             
  writeln('Hello World');

  writeln('</BODY></HTML>');

end.

_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
arthurrichards77
-


Joined: 22 Jun 2002
Posts: 2
Location: Boston MA

PostPosted: Sun Jun 23, 2002 4:07 pm    Post subject: sorted! Reply with quote

works like a charm - thanks for your help

furthermore, for general interest, I've started using the free C compiler mingw32 instead of DJGPP. Just include windows.h in your existing C file and it works just fine. No more Pascal.

Thanks again
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group