Board index » delphi » HTTP/CGI programming in BP7

HTTP/CGI programming in BP7

What must one do to make a BP program callable as a CGI executable
in NT?  I have succesfully run both C and PERL programs, but am
so far unable to get BP to work.

The CGI script must communicate with the HTTP Server via stdin and
stdout.  It seems that BP's I/O is defined differently.

The following program will run, but http returns a "Document Empty"
error message:

PROGRAM test;
BEGIN
 writeln('Content-type: text/plain');
 writeln;
 writeln('Hello from BP!!!!!');
END.

On the other hand, this PERL script works fine:
#!/perl/bin/perl.exe
print "Content-type: text/plain\n";
print "\n";
print "Hello from Perl!!!!!!\n";

PERL is specifically directing output to stdout.

Thank you in advance for any help you may be able to offer.

 ----------------------------------------------------------------------
|{*word*106} Harrigill,  who cannot speak for:  BOEING DEFENSE & SPAGE GROUP |
|  CDP, PP-ASEL, Good Guy                  Information Sys Development |
|  dick.harrig...@atc.boeing.com           MS 84-05, PO BOX 3999       |
|  206-773-5435 desk; 206-997-8764 pager   Seattle, WA  98124-2499     |
 ----------------------------------------------------------------------

 

Re:HTTP/CGI programming in BP7


Quote
dick Harrigill <dick.harrig...@atc.boeing.com> wrote:
>What must one do to make a BP program callable as a CGI executable
>in NT?  I have succesfully run both C and PERL programs, but am
>so far unable to get BP to work.
>The CGI script must communicate with the HTTP Server via stdin and
>stdout.  It seems that BP's I/O is defined differently.

I had the same problem !!

It seems that NT only can work with 32-bits applications for it's CGI
stuff.

Borland is not a 32-bits program.

Okay, it sounds weird but that was the point when i gave up....

If anybody got it working.. Let us know here in this group..

Bye, Paul

Re:HTTP/CGI programming in BP7


In article <48i0q7$...@news.bt.net>, p...@tref.nl? says...

Quote

>dick Harrigill <dick.harrig...@atc.boeing.com> wrote:

>>What must one do to make a BP program callable as a CGI executable
>>in NT?  I have succesfully run both C and PERL programs, but am
>>so far unable to get BP to work.

>>The CGI script must communicate with the HTTP Server via stdin and
>>stdout.  It seems that BP's I/O is defined differently.

>I had the same problem !!

>It seems that NT only can work with 32-bits applications for it's CGI
>stuff.

Well, that depends upon the web server software that you are using.
If you use O'Reilly and Associates WebSite, 16 bit apps work fine.
The author, Bob Denny, has implemented a Windows CGI interface that
allows 16 bit apps to function as CGI programs. He provides a canned
set of routines for Visual Basic which I've adapted to BP. One of the
parameters to the CGI program is a file name, which is where you should
write your output (rather than to StdOut).

Re:HTTP/CGI programming in BP7


 Dh> The following program will run, but http returns a "Document Empty"
 Dh> error message:

 Dh> PROGRAM test;
 Dh> BEGIN
 Dh>  writeln('Content-type: text/plain');
 Dh>  writeln;
 Dh>  writeln('Hello from BP!!!!!');
 Dh> END.

 Dh> On the other hand, this PERL script works fine:
 Dh> #!/perl/bin/perl.exe
 Dh> print "Content-type: text/plain\n";
 Dh> print "\n";
 Dh> print "Hello from Perl!!!!!!\n";

 Dh> PERL is specifically directing output to stdout.

Just a guess here, but maybe you need to do just that. Instead of using
writeln('string'), use writeln(stdout, 'string');

worth a shot.

Other Threads