re:Re: FastCGI, NCSA 1.5.2 & SSI

Mike Baptiste (baptiste@nortel.ca)
20 Jan 1997 15:19 EST

Message-Id: <199701202041.PAA27487@relay.openmarket.com>
Date: 20 Jan 1997 15:19 EST
To: gambarin@OpenMarket.com
From: "Mike Baptiste" <baptiste@nortel.ca>
Subject: re:Re: FastCGI, NCSA 1.5.2 & SSI

Scott,

The NCSA server disallows an exec cgi SSI (CGI or FastCGI - doesn't matter) 
IF you have data passed (via QUERY_STRING or PATH_INFO)  The basis for this 
was allowing PATH Translations (to datafill PATH_TRANSLATED from PATH_INFO) 
on an SSI would take too much time so they disallowed it.  Well, when they 
did that they disallowed data being passed in via QUERY_STRING as well (All 
they do is check the filename of the cgi and ensure nothing else exists at 
the end of the URL).  According to the NCSA designer I spoke with it just 
happened and no one seemed to care.

Anyway, to try and exec a cgi with QUERY_STRING data (fast CGI or not) you 
have to patch the http_include.c module with:

*** http_include.c.orig Fri Nov 10 15:43:54 1995
--- http_include.c      Mon Nov 13 15:17:33 1995
***************
*** 338,343 ****
--- 338,344 ----
      char op;
      int allow,check_cgiopt;
      struct stat finfo;
+     char *query, a[HUGE_STRING_LEN];
  
      getparents(reqInfo->url);
      if(reqInfo->url[0] == '/') {
***************
*** 351,356 ****
--- 352,364 ----
          make_full_path(dir,reqInfo->url,reqInfo->filename);
          check_cgiopt=1;
      }
+ 
+     /* Lets allow data via QUERY_STRING but not PATH_INFO  
baptiste@bnr.ca */
+     if (query = strchr(reqInfo->filename, '?')) {
+        *query++ = '\0';
+        strcpy(reqInfo->args, query);
+     }
+ 
      /* No hardwired path info or query allowed */
      if(stat(reqInfo->filename,&finfo) == -1)
          return -1;

This allows you to pass data in vi QUERY_STRING in an SSI exec cgi. (Beware 
- if the cgi crashes (Error 500) due to a syntax error or something, the 
server child serving the request gets killed & restarted - memory problem I 
never figured out)

So this will get you a normal CGI exec cgi SSI working with passed data.  
AS for FastCGI, I don't see why it wouldn't work, but I haven't tried it.

So, if you want to stick with NCSA, this should help, but I'd switch to 
Apache.

Mike Baptiste
NORTEL, Inc
baptiste@nortel.ca

In message "Re: FastCGI, NCSA 1.5.2 & SSI", gambarin@OpenMarket.com writes:

>> I have succesfully installed the fcgi-devel-kit, Made perl5.003, and installed
>> NCSA 1.5.2 HTTPD server. I have created a FCGI perl script to lookup values
>> from a mSQL server. All of the above works fine, except I would like to be able to
>> use this as a SSI(server side include). However when I attempt to use it with either
>> the "exec cmd" or the "exec cgi" I get the following responce in the page,
>> 
>> [an error occurred while processing this directive]
>> 
>> I have even attempted to use the "include" and "include virtual" with the same result.
>> 
>> Scott Franzyshen
>> saf@bigsurf.net
>
>	I took a brief look at the NCSA code and I don't think that it is
>possible to use SSI with FastCGI apps.  All NCSA allows you to do is
>either do an exec() and obtain output (for cgi) or just cat the file 
>(for regular includes).  Without being biased toward NCSA, I would like
>to suggest Apache server, that does provide a way to support SSI with
>FastCGI and remains highly compatible with NCSA configuration files.
>								Stanley.
>-- 
>*******************************************************************************
>* To unsubscribe from the fastcgi-developers mailing list		      *
>* 		mailto: fastcgi-developers-request 		      	      *
>*		with body containing: unsubscribe       		      *
>* To request help for using the fastcgi-developers mailing list		      *
>* 		mailto: fastcgi-developers-request 		      	      *
>*		with body containing: help		       		      *
>*******************************************************************************
>
>*******************************************************************************
>* Stanley Gambarin			Open Market Inc.		      *
>* FastCGI (soon-to-be) Guru		245 First St. Cambridge MA 02142      *
>*					(617) - 949 - 7487		      *
>* mailto:gambarin@openmarket.com					      *
>* 				http://acs2.bu.edu:8001/~stanleyg (school)    *
>*				mailto:stanleyg@cs.bu.edu		      *
>*******************************************************************************
>
>
>