Board index » delphi » CGI: Delphi for CGI ? (STDIN, STDOUT)

CGI: Delphi for CGI ? (STDIN, STDOUT)

Is there any information around that might help in the aid of deciding
what programing language to use for CGI programs?

I'm looking at using Delphi but am wondering the procedures for STDIN
and STDOUT and what it takes, are there any examples out there or any
information on this ?

Paul Stohr
pst...@siteit.com

Would prefer replies via E-mail, Thanks

 

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


Quote
pst...@siteit.com (Paul Stohr) wrote:

|}Is there any information around that might help in the aid of deciding
|}what programing language to use for CGI programs?

There is a web page devoted to doing CGI programs in Delphi, but I can't
remember it right off the top of my head.  Sorry.

Hopefully, someone will follow-up to your message with that address.
-------------------------------------------------------------
Kerry Sanders                 | "Cause when ya stop dreaming
ksand...@bham.mindspring.com  |    its time to die" - CHANGE
-------------------------------------------------------------

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


Well, if you are using Website (for NT) or the 16 bit version (for WfW3.11) of
the same Web server, using Delphi or VB for the CGI is _easy_.

OW, forget it.  Delphi doesn't support STDIN, or STDOUT, at least so far as
anyone here can figure out.  

WebSite uses something called, CGI-WIN.  It uses .ini files to hand info to
and from the script.  Some excellent places to look at are:

http://super.sonic.net/ann/

http://website.ora.com/

Hope this is of some help.  (BTW, the 16 bit version is free for edu or
personal...)

CJK
--
Christopher J. Knowles
cknow...@sel-rtp.com
Programmer, IS Dept.
SEL

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


HREF Tools Corp. are offering a package called WebHub, a Delphi-based
CGI solution.  Check out their Web page at http://www.href.com

Kim Baker

Quote
Kerry Sanders wrote:

> pst...@siteit.com (Paul Stohr) wrote:

> |}Is there any information around that might help in the aid of
deciding
> |}what programing language to use for CGI programs?

> There is a web page devoted to doing CGI programs in Delphi, but I
can't
> remember it right off the top of my head.  Sorry.

> Hopefully, someone will follow-up to your message with that

address.

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


Try http://www.href.com

Ron.

In article <30cd2b4a.9302...@news.mindspring.com>,

Quote
Kerry Sanders <ksand...@bham.mindspring.com> wrote:
>pst...@siteit.com (Paul Stohr) wrote:

>|}Is there any information around that might help in the aid of deciding
>|}what programing language to use for CGI programs?

>There is a web page devoted to doing CGI programs in Delphi, but I can't
>remember it right off the top of my head.  Sorry.

>Hopefully, someone will follow-up to your message with that address.
>-------------------------------------------------------------
>Kerry Sanders                 | "Cause when ya stop dreaming
>ksand...@bham.mindspring.com  |    its time to die" - CHANGE
>-------------------------------------------------------------

--
Ron Loewy, HyperAct, Inc. +1 (319) 351 8413  | rlo...@hyperact.com
Author of HLPDK/PA, CatMake, Interactive Help and HyperTerp.
Visit our home page at http://www.hyperact.com .

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


Quote
On Tue, 12 Dec 1995, Christopher J. Knowles wrote:
> OW, forget it.  Delphi doesn't support STDIN, or STDOUT, at least so far as
> anyone here can figure out.  

Not so!  Look at the WinCRT source and see how it works, relating to
borland file objects.  It is a simple matter to write a driver to be
called by delphi to read and write text for STDIN and STDOUT.  The
question is, how does windows deal with STDIN and STDOUT so we can route
the data, instead of WinCRT routines, to the API call.

--
Sam Liddicott                  |   Nothing I say is to be attributed as
Campbell Scientific Ltd.       | a company statement or representation.
14-20 Field Street, Shepshed,  *----------------------------------------
Leicestershire,                             Phone: +44 (0) 1509 601141
United Kingdom. LE12 9AL                    Fax:   +44 (0) 1509 601091

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


Quote
Sam Liddicott (s...@csluk.demon.co.uk) wrote:

: On Tue, 12 Dec 1995, Christopher J. Knowles wrote:

: > OW, forget it.  Delphi doesn't support STDIN, or STDOUT, at least so far as
: > anyone here can figure out.  

: Not so!  Look at the WinCRT source and see how it works, relating to
: borland file objects.  It is a simple matter to write a driver to be
: called by delphi to read and write text for STDIN and STDOUT.  The
: question is, how does windows deal with STDIN and STDOUT so we can route
: the data, instead of WinCRT routines, to the API call.

Windows itself doesn't support stdin/stdout. You have to write DOS programs
tp do it (where Windows fakes it), and for that you need a load of
BP7 libraries...

--
"...I'll leave my mind beneath the mat, so you can let yourself in,
if you can stand the mess then stay, but i'm not entertaining..."

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


In article <4av5bv$...@net.auckland.ac.nz>, Richard Vowles
<r...@comu2.auckland.ac.nz> writes

Quote
>Windows itself doesn't support stdin/stdout. You have to write DOS programs
>tp do it (where Windows fakes it), and for that you need a load of
>BP7 libraries...

Aahh, but NT and Win95 do (and possibly win32s). The question is, how?

=======================================================================
| <Julian Bond> jul...@shockwav.demon.co.uk                PGPKey@MIT |
| Quetzal & Q-Support, Help Desk and Inventory Management for Windows |
|                 "So many words, So little time"                     |
=======================================================================

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


On 16 Dec 1995, Richard Vowles wrote:

Quote
> Sam Liddicott (s...@csluk.demon.co.uk) wrote:
> : On Tue, 12 Dec 1995, Christopher J. Knowles wrote:

> : > OW, forget it.  Delphi doesn't support STDIN, or STDOUT, at least so far as
> : > anyone here can figure out.  

> : Not so!  Look at the WinCRT source and see how it works, relating to
> : borland file objects.  It is a simple matter to write a driver to be
> : called by delphi to read and write text for STDIN and STDOUT.  The
> : question is, how does windows deal with STDIN and STDOUT so we can route
> : the data, instead of WinCRT routines, to the API call.

> Windows itself doesn't support stdin/stdout. You have to write DOS programs
> tp do it (where Windows fakes it), and for that you need a load of
> BP7 libraries...

Well.... wait a minute then, whats the problem?
We can write delphi routines to catch the input and output from Write,
Writeln, Read ReadChar etc; if this CGI stuff isn't using windows STDIN
and STDOUT, but writing direct to sockets, then we can do the same?

Is that what the question is?

--
Sam Liddicott                  |   Nothing I say is to be attributed as
Campbell Scientific Ltd.       | a company statement or representation.
14-20 Field Street, Shepshed,  *----------------------------------------
Leicestershire,                             Phone: +44 (0) 1509 601141
United Kingdom. LE12 9AL                    Fax:   +44 (0) 1509 601091

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


Quote
Sam Liddicott (s...@csluk.demon.co.uk) wrote:

: Well.... wait a minute then, whats the problem?
: We can write delphi routines to catch the input and output from Write,
: Writeln, Read ReadChar etc; if this CGI stuff isn't using windows STDIN
: and STDOUT, but writing direct to sockets, then we can do the same?

: Is that what the question is?

Ah.... no. Standard CGI works by creating a new application via a pipe
and opening that pipe for read and write. It stuffs down all of the
information into the pipe from the client, and expects information
stuffed back to itself. Since Windows applications don't actually
HAVE stdin/stdout, much faking goes on to provide the facilities and
since only DOS type apps have stdin/stdout, you have to write DOS
stuff to get what you want. This screws you up if all of your connectivity
tools are in Windows (which most are) rather than DOS, so the chappy who
wrote the 16bit Windows HTTP server (can't remember his name, his 32
bit is WebSite) invented CGI-WIN, which writes all of the mime info
from the client + all form data to a .INI file (as well as the file
it expects to have the returning data in) and then runs your program
(which should pick up the INI file, do its stuff and write the result
back to the file specified in the .INI file by the server). As you
can imagine, this is a tedius, slow pain in the arse. For database
stuff, it means that you have to connect/disconnect from your server
for each and every connection to your server. It also means that your
server is having to run a (potentially) large app for each request that
comes in, and although caching can do something to alleviate this,
it doesn't help much. We (at the UNiversity of Auckland) struck this
very problem, we have certain machinery (which is what makes the job
cost effective for deployment) which must be capable of supporting a
large number of hits per second, and CGI-WIN was not up to it. We
did investigate the Web-Hub components from Michael Ax (which uses
a much smaller cgi-win program to feed requests thru a dll to your
app which is running all the time) but it wasn't quite as flexible
as we needed and it was early stages for them. What we did instead
is write our own Web server in Delphi (and discovered a major bug in
DWINSOCK on the way (1.42 should be released sometime shortly what
I last communicated with the development team)) and provide a number
of objects which we pass to various routines (which have registered
a URL with the main engine). By allowing the use of memory streams
it means that requests can never touch anything but the database
if we so wish... The resulting server is quick on response times (we
had it generating tabbed notebook style GIF images on the fly) but
being 16 bit is only single threaded at this stage. Once we get
Delphi 2, we will make it multi-threaded on the DIspatch area...

Source code will be available of course.... <grin>

Richard

--
"...I'll leave my mind beneath the mat, so you can let yourself in,
if you can stand the mess then stay, but i'm not entertaining..."

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


In article <4blcgj$...@net.auckland.ac.nz>, Richard Vowles
<r...@comu2.auckland.ac.nz> writes

Quote
>Sam Liddicott (s...@csluk.demon.co.uk) wrote:
>: Well.... wait a minute then, whats the problem?
>: We can write delphi routines to catch the input and output from Write,
>: Writeln, Read ReadChar etc; if this CGI stuff isn't using windows STDIN
>: and STDOUT, but writing direct to sockets, then we can do the same?

>: Is that what the question is?

>Ah.... no. Standard CGI works by creating a new application via a pipe
>and opening that pipe for read and write. It stuffs down all of the
>information into the pipe from the client, and expects information
>stuffed back to itself. Since Windows applications don't actually
>HAVE stdin/stdout,

[long snip about website and stuff]

What you say is certainly true in Win 3.11, however, I believe that
there is more to this in Win95 and NT (and possibly WIN32s) There is
very little documentation about this and unfortunately I don't have it
with me, so bear with me. The only information I have been able to find
was in a short article on the MSDN CD about porting Unix applications to
NT. There is presumably more in the Win32 SDK docs somewhere.

It appears that STDIN and STDOUT *are* supported in Win95 and NT. There
is a slight difference that they do not use the same file handles as in
DOS and you need to make a winapi call to get file handles allocated to
you. This is going to be hard to use in Delphi 16 but should be a simple
matter in Delphi 32. As an example of this, WebSpace and Worldview (32
bit VRML browsers) spawn a copy of gzip.exe to decode .gz files via
STDIN/OUT.

Now there are several Web Servers which have been ported to NT that
support CGI but not WinCGI and presumably they use STDIN/OUT with one of
the perl implementations. There is no reason that I can see why it
should not be possible to use Delphi 32 to work with these and then to
access other sources of data as well.

I'm still trying to understand this, so if anyone else can throw any
light on it, feel free to comment, especially if you have used the beta
Delphi 32 to program it. One key question is whether this is possible
from GUI apps or only console apps.

=======================================================================
| <Julian Bond> jul...@shockwav.demon.co.uk                PGPKey@MIT |
| Quetzal & Q-Support, Help Desk and Inventory Management for Windows |
|                 "So many words, So little time"                     |
=======================================================================

Re:CGI: Delphi for CGI ? (STDIN, STDOUT)


In article <u2AM4EA9gw4wE...@shockwav.demon.co.uk>,

Quote
Julian Bond <jul...@shockwav.demon.co.uk> wrote:
> It appears that STDIN and STDOUT *are* supported in Win95 and NT. There
> is a slight difference that they do not use the same file handles as in

Atleast they're supported under NT...

As for Win95? well... I'm not sure, but when it comes to pipes between
two machines on the network, the Win95 (or WfWg 3.11 for that matter) machine
can only be at the client end, while the NT machine function as the
server.

So, if Win95 is involved: Be careful.

There exist a component to make Win32 API calls from a Delphi16 app,
so that one could start the work now.

A webserver developed in Delphi would be nice though! :-)

=\           Q: Where can you get Street Fighting Man, Like A Rolling Stone,
 *=- R.Moberg,  Not Fade Away, Shine A Light, Angie ...and... I'm Free?
=/           A: This and more is on The Rolling Stones' latest CD: stripped!

Other Threads