Re: Windows NT and FastCGI

Benjamin Gavin (
Thu, 28 Aug 1997 10:56:51 -0500

Message-Id: <>
Date: Thu, 28 Aug 1997 10:56:51 -0500
From: Benjamin Gavin <>
Subject: Re: Windows NT and FastCGI

Hi all,
  I have gotten the echo program working again.  One word of caution.  Use
the developers kit directly as stated in the README_NT.txt.  My problem
arose when I tried to recompile it using the GUI for DevStudio 5.0.  I did
recompile using the build_no_shell.bat and it compiled fine, and the
echo_nt program worked.  The problem must have been in my recompilation of
the libfcgi.dll file.

>>  I did those steps and it compiled/executed fine.  I can't understand why
>>it wouldn't be working.  What I did do was try to recompile the library
>>using the new DevStudio 5.0, and making the lbfcgi.dll a project, and the
>>cgi-fcgi.exe part of the project.  One thing that you may want to consider
>>is including the project files from the the original build instead of just
>>the exported makefiles.  Are there any special switches that need to be set
>>in the compiler statement to get it to compile correctly??  I just can't
>>understand why it would work from the command line and not from the GUI.
>>Weird.  If I remember correctly you are no longer directly involved with
>>the project..  Is that correct??  Either way, thank you for your time.  I
>>appreciate it.
>>At 11:12 AM 8/28/97 -0400, you wrote:
>>>I just performed the following experiment.
>>>1) Downloaded the FastCGI kit from the web site.
>>>2) Extracted the kit.
>>>3) cd'd into the top level directory of the kit.
>>>4) ran "build_no_shell.bat"
>>>5) My script map entry was added to point to the newly built cgi-fcgi.exe
>>>7) Started IIS
>>>8) Accessed echo_nt.fcgi and gave it a query string.
>>>9) Did this again and changed the query string.  It came out as the new
>>>   string.
>>>Please try this with VC5 and let me know the results.  I will see if
>>>I can run this on a VC5 system later but I doubt I'll get to it today.
>>>- Bill -
>>>At 09:31 AM 8/28/97 -0500, you wrote:
>>>>  I don't know if you saw my second post, but I did get it to work with
>>>>echo2_nt.fcgi.  It worked just as you described.  I had some similar
>>>>problems with my C-based CGI utility library, so I ported it over to C++
>>>>and it worked fine.  Do you think it may have to do with VC5??  The reason
>>>>I ask is because I need the MFC stuff to talk to the Database, I have no
>>>>choice but to leave that code in there.  Besides the MFC libraries should
>>>>have no effect on non-MFC code in the program, should it??  Anyway thanks
>>>>for your replies.
>>>>At 08:45 AM 8/28/97 -0400, you wrote:
>>>>>Hello Ben,
>>>>>I just ran the same experiment with echo and got the new QUERY_STRING
>>>>>each time I accessed the script.
>>>>>I will download the kit from today to see if there's
>>>>>anything I've fixed in my version which didn't get rolled into the
>>>>>official beta (cause it is a beta) release.
>>>>>The differences I see with your environment however are as follows:
>>>>>1) I don't use MFC.
>>>>>2) I've been using only C and not C++
>>>>>3) My libraries have been built on VC++ 4.2 and not VC5.
>>>>>- Bill -
>>>>>At 04:45 PM 8/27/97 -0500, Benjamin Gavin wrote:
>>>>>>  I ran the echo program and had the same problem.  I started with the
>>>>>>QUERY_STRING=hello, and then proceeded to change it over and over,
but no
>>>>>>matter what the page that was returned got QUERY_STRING=hello.  The PID
>>>>>>stayed the same, and the count incremented, but no change to the query
>>>>>>string.  I'll answer your question below to see if you have any more
>>>>>>>1) What version of the FastCGI libraries are you using?
>>>>>>  2.0b2
>>>>>>>2) What is your app written in?
>>>>>>  C++, Microsoft Visual C 5.0
>>>>>>>3) Have you tried the experiment of posting to "echo" for example
>>>>>>>   to see the different variables?
>>>>>>  Yes, as described above.  Just for informations sake I'll give you the
>>>>>>configuration that I am using.  Windows NT 4.0 Workstation, IIS 3.0,
>>>>>>Pentium 133, 48MB RAM.  Not sure what else you would need.  I can run
>>>>>>program fine using it as CGI, but opening VERY expensive database
>>>>>>connections is very slow with regular CGI.  I also compiled the
>>>>>>with MFC compatibility since I am going to be doing database accesses.
>>>>>>other ideas??
>>>>>>Thanks for your reply,
>>>>>>P.S.  I have also recieved letters from others saying they had the same
>>>>>>problem and asking that I forward a solution if one is found.
>>>>>>>I just ran a GET against the echo.c application and each time sent
>>>>>>>an HTTP header called foo and changed the value each time I issued
>>>>>>>the request.  Each time there was a new variable seen by the echo
>>>>>>>application and the counter was incrementing.
>>>>>>>- Bill -
>>>>>>>At 12:23 PM 8/27/97 -0500, you wrote:
>>>>>>>>Hi all,
>>>>>>>>  I don't know what happened to my last post, so I'll send another.
>>>>>>>>if the same thing shows up twice...
>>>>>>>>  I am having MAJOR problems with FastCGI under Windows NT.  It seems
>>>>>>>>no matter how I change the environment variables between calls to the
>>>>>>>>FastCGI process, They DO NOT CHANGE according to the FastCGI process
>>>>>>>>itself.  A simple example will illustrate the point...
>>>>>>>>1a)  Submit form using GET, content-length=50
>>>>>>>>  result:  FastCGI program starts up, gets correct data.
>>>>>>>>2a)  Change form submittal to POST, content-length=50
>>>>>>>>  result:  Still reads from the original QueryString, as if GET was
>>>>>>>>1b)  Submit form using POST, content-length=30
>>>>>>>>  result:  FastCGI program starts up, get correct data
>>>>>>>>2b)  Submit form using POST, content-length=29
>>>>>>>>  result:  FastCGI program tries to read 30, gets bogus last character
>>>>>>>>3b)  Submit form using POST, content-length=31+
>>>>>>>>  result:  FastCGI reads only first 30 characters
>>>>>>>>4b)  Submit form using GET, content-length=30
>>>>>>>>  result:  30 random characters read from standard input, sometimes
>>>>>>>>           kills program, sometimes continues with bogus info.
>>>>>>>>As far as I can tell the FastCGI program gets only one set of
>>>>>>>>variables.  It gets whatever set it is started up with, but no more.
> No
>>>>>>>>matter what changes I make to the environment variables, there are no
>>>>>>>>changes to the FastCGI programs environment after the first call.
>>>>>>>>works fine if the method is POST and each input set has the exact same
>>>>>>>>content-length, but how often does that happen???  It doesn't matter
>>>how I
>>>>>>>>get the environ variables, using FCGX_GetParam, or getenv.
>>>>>>>>Please, I need FastCGI's speed improvements.  I DO NOT want to port
>>>>>>>>existing program into an ISAPI dll... YUCK!!  Any ideas would be
>>>>>>>>Ben Gavin

Ben Gavin

  Benjamin Gavin - Internet Software Developer
  SupraNet Communications, Inc.
  8000 Excelsior Dr.  Madison, WI   53717
  Phone: 608.836.0282, Fax: 608.836.0283
  Pager: 608.682.1153