NT libraries

Stanley Gambarin (gambarin@OpenMarket.com)
Fri, 21 Mar 1997 17:41:02 -0500

Message-Id: <199703212241.RAA04463@u4-138.openmarket.com>
To: fastcgi-developers@OpenMarket.com
Subject: NT libraries
Date: Fri, 21 Mar 1997 17:41:02 -0500
From: Stanley Gambarin <gambarin@OpenMarket.com>

	Greetings, fellow FastCGI developers.  As per your numerous requests
FastCGI libraries have been ported to the Windows NT platform.  This message
is a small FAQ that should get you started developing FastCGI applications
on Windows NT 3.51 or higher.

1. Is this an official release ?
	No, this release is designated as 2.0 beta 1 and is distributed for
the purpose of testing and elimination of "non-existant" bugs.  After a break
in period, an official public release will be made.

2. What platforms are supported ?
	This release supports all Unix platforms that were used to be supported
in the previous releases and Windows NT 3.51 or higher.  Windows 95 and 
Windows NT 3.5 are NOT supported.  Outside effort in porting to these platforms
is always welcomed, but no inhouse port to Win95 has been scheduled.

3. Why do I get errors compiling on Unix platforms ?
	This release was only tested under Solaris 2.5 and Windows NT, so you
may have problems compiling under other Unix platforms.  I would appreciate
any feedback in correcting those before the release.

4. Is there any new additional functionality ?
	No, the main purpose was to port libraries to NT and that has been
done.  No additional features have been introduces in the libraries.

5. What does the above port give me ?
	The port of the FastCGI libraries allows you to develop FastCGI 
application under Windows NT.  It also allows you to continue developing
FastCGi applications under various Unix platforms.

6. How do I setup the test client ?
	Follow the instructions provided in the file README_NT.txt, which
is included in the beta of the FDK.  This allows you to setup the test 
environment under Microsoft IIS server.  (I would appreciate if someone 
could send me the setup for Netscape and other servers as well, which I don't
believe should be that different).  You will need a copy of Microsoft 
Visual C++ (4.0+) to compile the test programs (once again, I would appreciate
if anyone can provide the makefiles for compiling under Borland, Watcom 
and other compilers).

7. How does the web server communicate to fcgi app under NT?
	The communication is accomplished via cgi-fcgi gateway.   There 
is NO native support for ISAPI or NSAPI in the current release of the
FDK (as always, outside effort is welcomed).

8. TroubleShooting:
	- make sure to build the fastcgi library as a multithreaded one.  This
is needed since the implementation of cgi-fcgi uses threads.
	- make sure to correctly configure the registry using instructions 
provided in the README_NT.txt
	- report any problems by sending mail to fastcgi-developers mailing
list, detailing your configuration, setup, etc.

9. Debugging:
[...]
The problem as far as debugging an application is concerned on NT is
that the server does not allow a cgi script to launch the debugger
easily which makes setting breakpoints sorta difficult.  I'm certain
there's got to be some knobs and dials one could play with to make this
work but I've yet to find them.

I have come up with a workaround however and it's fairly simple.  It
involves:

1) Using TCP/IP to communicate with the FastCGI application (even an
   app running on the same machine as the server)

2) Adding the following lines to your FastCGI program BEFORE the
   call to FCGI_Accept is made.

    if(getenv("DEBUG_FCGI")) {
        DebugBreak();
    }

3) Launching your application from the command line as follows:

    cgi-fcgi -start -connect :8080 -dbgfcgi ./echo.exe

4) Modifying your text file that the "shim" talks to at HTTP request
   time as follows:

#!../cgi-fcgi/cgi-fcgi -f
-connect :8080 ./echo2.exe


The debugger will come up when cgi-fcgi launches your application.  The
-dbgfcgi switch is what set the "DEBUG_FCGI" environment variable.  It
will set if to the value of "TRUE" if you really want to test for it.
I chose to test for the existence of the name.  This  allows you to set 
breakpoints that can be hit at request time.  Once breakpoints have been 
set, hit F5 (run) and your FastCGI application should go into the 
blocking FCGI_Accept() call.

10. Where can I get the libraries ?
	The libraries are available on the website. (the link should be 
operational next week)  In the meantime, you can download them directly at
http://www.fastcgi.com/applibs/2.0b1/fcgi-devel-kit.tar.Z
	NOTE: this is a BETA release.  We would appreciate any useful
feedback and bug reports.  Thank you.

						Stanley.