cgi in turbo pascal or freepascal in windows 95 
Author Message
 cgi in turbo pascal or freepascal in windows 95

Could someone please post some simple code in turbo Pascal or freepascal
that will do cgi in windows 95?

Thank you



Wed, 18 Jun 1902 08:00:00 GMT  
 cgi in turbo pascal or freepascal in windows 95

Quote:

> Could someone please post some simple code in turbo pascal or freepascal
> that will do cgi in windows 95?

Here's one for FPC:
<http://www.freepascal.org/fpc-linux/cgi/uncgi-2.0.11.tar.gz>. It works
both on windows and linux.

Jonas



Wed, 18 Jun 1902 08:00:00 GMT  
 cgi in turbo pascal or freepascal in windows 95


Quote:
> Could someone please post some simple code in turbo pascal or
freepascal
> that will do cgi in windows 95?

> Thank you

When you install FreePascal you should find a unit in the RTL called
EZCGI.PAS. This unit does all the CGI basics and it works on Windows or
Linux. I've used it and it works really well with Apache (and probably
any other web server that supports standard CGI).

Garry.

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 cgi in turbo pascal or freepascal in windows 95

Quote:

>> Could someone please post some simple code in turbo pascal or
>freepascal
>> that will do cgi in windows 95?

>> Thank you

>When you install FreePascal you should find a unit in the RTL called
>EZCGI.PAS. This unit does all the CGI basics and it works on Windows or
>Linux. I've used it and it works really well with Apache (and probably
>any other web server that supports standard CGI).

This is in the component library FCL I believe.


Wed, 18 Jun 1902 08:00:00 GMT  
 cgi in turbo pascal or freepascal in windows 95

Quote:



> > Could someone please post some simple code in turbo pascal or freepascal
> > that will do cgi in windows 95?

> Here's one for FPC:
> <http://www.freepascal.org/fpc-linux/cgi/uncgi-2.0.11.tar.gz>. It works
> both on windows and linux.

> Jonas

I very much appreciate your information but this code is WAY to
complicated for me to make any use out of it at the present time. :(

Would you happen to have a 'Hello World' level freepascal or tpc CGI
program?

Thank you,



Wed, 18 Jun 1902 08:00:00 GMT  
 cgi in turbo pascal or freepascal in windows 95

Quote:

> Could someone please post some simple code in turbo pascal or
> freepascal that will do cgi in windows 95?

> Thank you

I had a need for a 'Hello World!' level cgi program and I wanted to use
pascal (turbo pascal, freepascal and console delphi pascal dialect)
because of pascal's great string handling functions, ease of programming
and small and fast exe's. All of which make it a great programming
language for use in cgi programming.

The first 'Hello World!' cgi program I compiled was the following Turbo
C++ code I recieved in an IRC channel :

#include <iostream>
int main()
{
cout << "Content-type: text/html\n\n <html><body><p>Hello
World!</p></body></html>";
return 0;

Quote:
}

I translated it into the following turbo pascal, freepascal and console
delphi pascal dialect 'Hello World!' cgi program :

program cgi1;
const nl = chr(13) + chr(10);
begin
write('Content-type: text/html',nl,nl);
write('<html><body>');
write('<p>Hello World!</p>');
write('</body></html>');
end.

Then into the following ADA 'Hello World' cgi program :

With Text_IO; Use Text_IO;
Pragma RangeCheck(off); Pragma Debug(off); Pragma Arithcheck(Off);
Procedure cgi1 Is
Begin
Put("Content-type: text/html"); New_Line; New_Line;
Put("<html><body>");
Put("<p>Hello World!</p>");
Put("</body></html>");
End cgi1;

The Html code that calls the cgi is :

<!-html for cgi->
<HTML>
<BODY>
<TITLE>CGI Example</TITLE>
<H1>CGI Example</H1>
<FORM ACTION="/cgi-bin/cgi1.exe" METHOD="POST">
<INPUT TYPE="submit" VALUE="Press Here">
</FORM>
</BODY>
</HTML>

Of course these programs are completely stripped down stdin/stdout
programs, but that is all that is needed for a starting cgi program.

A cgi 'Hello World' program is very useful to test whether the web
server is set up properly, the internet and computer systems are
functioning as needed, as well as a 'first program' on which to begin
with and gain cgi programming confidence.

Thank you to Jonas Maebe, Garry Wood, and Marco van de Voort for
replying to my inquiry.

With freepascal running on both Windows and Linux it is the way to go.



Wed, 18 Jun 1902 08:00:00 GMT  
 cgi in turbo pascal or freepascal in windows 95

Quote:
> I translated it into the following turbo pascal, freepascal and
console
> delphi pascal dialect 'Hello World!' cgi program :

> program cgi1;
> const nl = chr(13) + chr(10);
> begin
> write('Content-type: text/html',nl,nl);
> write('<html><body>');
> write('<p>Hello World!</p>');
> write('</body></html>');
> end.

I think you should use writeln instead of using constants
to specify end-of-line. Like so

program cgi1;
begin
writeln('Content-type: text/html');
writeln;
write('<html><body>');
write('<p>Hello World!</p>');
write('</body></html>');
end.

Quote:
> With freepascal running on both Windows and Linux it is the way to go.

Have you considered using Irie Pascal?
Before I go any further I must admit that I am biased becuase I am
the author of Irie Pascal but I think it is worth considering.

The website is www.irietoools.com.

The current version of Irie Pascal has a problem with
Microsoft Personal Web Server and IIS. A fix for this problem
is ready but I want to test with Apache for Windows before
I release the fix.

If you are at all interested then you can contact me
through this forum or through the website and I will
provide you with more information and the fix when it
becomes available.

PS: Irie Pascal also runs on both Windows and Linux.

Stuart

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 cgi in turbo pascal or freepascal in windows 95

Please, for everyone posting in this thread, trim out
comp.lang.ada, since as far as I can tell this thread
has zero Ada content???

Sent via Deja.com http://www.deja.com/
Before you buy.



Wed, 18 Jun 1902 08:00:00 GMT  
 cgi in turbo pascal or freepascal in windows 95
In the user manual in the fpc manual section "9.1.1 Data coming through
standard input." there is some "Post Method" CGI code there.

Could someone from fpc tell me why they are checking for '\'? (see code
sippet below from manual). I am unable to generate a '\' in the
URLencoded string from a form using Post Method - so I was wondering
what would generate a '\' in an URLencoded string.

while not eof(input) do
  begin
  literal:=false;
  read(c);
  if c='\' then      <---------****
     begin
     literal:=true;
     read(c);
     end;
  if literal or ((c<>'=') and (c<>'&')) then
     with data[nrdata] do
        if aname then name:=name+c else value:=value+c
  else
     begin
     if c='&' then
         begin
         inc (nrdata);
         aname:=true;
         end
      else
         aname:=false;
      end
  end;

Also are there any buffer overflow concerns using fpc or tpc in CGI
programming?

thanks,



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 10 post ] 

 Relevant Pages 

1. cgi in turbo pascal or freepascal in windows 95

2. cgi in turbo pascal or console delphi for windows 95

3. FreePascal and Window 95

4. Turbo Pascal for Windows doesn't quite work w/ Win 95

5. Using Turbo Pascal version 5.5 in Windows 95

6. Problems, Turbo Pascal 6 and Windows 95 (DOS mode)

7. Turbo Pascal 6 and Windows 95 (Dos Mode)

8. Missing PRNFLTR for Turbo Pascal 7.0 on Windows 95/98

9. Windows (95) + Turbo Pascal 6.0

10. Turbo Pascal 7.0, Ctrl/Brk and windows 95

11. Turbo Pascal 5.5 / Windows 95 LFN Question

12. Windows 95 And Turbo Pascal 7.0

 

 
Powered by phpBB® Forum Software