cgi-fcgi command line problems
Sat, 07 Sep 96 04:58:34 GMT

Subject: cgi-fcgi command line problems
Date: Sat, 07 Sep 96 04:58:34 GMT
Message-Id: <>

1. "-f" and line split is REQUIRED
I got the impression from the documentation that the "-f" parameter and the 
splitting of the command line into 2 lines was optional, but when I tried it, I 
found that it is *required*.

If I put all the parameters on the first line and leave out the "-f", ie:

   #!..../cgi-fcgi -connect sockets/whatever  whatever
   script source code

Unix will append the script name to the end, and then cgi-fcgi will complain 
that there is an extra, unrecognized parameter and quit with an error status.  
Hence, I cannot put it all on one line (which I would like to do in order to 
avoid openning and reading another file).

As a work-around for this, I changed ParseArgs in cgi-fcgi.c to recognize the 
parameter "-eol" and then stop parsing for parameters.  So now I can put all 
the parameters on the first line as follows:

   #!..../cgi-fcgi -connect sockets/whatever  whatever -eol
   script source code

and the extra script file name parameter won't get in the way.

2. Linux command parameter concatenation
In working through the problem above, I discovered that Linux 1.2.1/Slackware 
2.0.0 (and maybe other Linuxes and Unixes) actually *concatenate* all of the 
parameters on the first line together into *one* entry in argv[].  For example, 
for the script above, I was getting:

    argv[0] = script interpreter name
    argv[1] = "-connect sockets/whatever  whatever -eol"
    argv[2] = script path name (added by system)

As I do not usually put more than one parameter on the first line of a script, 
I can't say whether this happens in other types of Unix or not.

In order to work around this problem, I added some code at the start of main() 
to split argv[] entries that contained spaces (similar code appears within 
ParseArgs for parsing parameters contained in an external file with "-f").

Has anybody else encountered these problems?  Would it be possible to add these 
fixes (or something better) to the next version of cgi-fcgi?  The changes 
described above would be transparent to anybody using the "-f" and split line 

Don Julien