You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Alexei Kosut <ak...@organic.com> on 1996/06/21 22:56:05 UTC

patch for inetd

Here's a patch to make CGI scripts with with inetd, since in the current
release they don't, as has been pointed out to us.

It's an unhappy fix, but it works. The problem is that cleanup_for_exec
ends up (through no fault of its own), closing stdout, because spawn_child
tells it to. Because in the standalone version, you only want the child to
have stdout, not the parent. Unfortunately, in the inetd version, the
parent still needs stdout, because (duh) that's where it writes to.

The other is not to call note_cleanups_for_file in spawn_child() for inetd
servers, but they should amount to the same thing. And because all inetd
processes last for only one connection, I don't think it's too much of a
problem not cleaning all the fds up properly.

Anyhoo, here's the patch. While I think it might be a good idea to excise 
inetd support from future versions, for now, we still make a pretense at
supporting it, and presumably CGI should work.

Index: mod_cgi.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_cgi.c,v
retrieving revision 1.10
diff -c -r1.10 mod_cgi.c
*** mod_cgi.c	1996/06/17 20:43:47	1.10
--- mod_cgi.c	1996/06/21 20:51:30
***************
*** 72,77 ****
--- 72,78 ----
  #include "http_protocol.h"
  #include "http_main.h"
  #include "http_log.h"
+ #include "http_conf_globals.h"
  #include "util_script.h"
  
  /* KLUDGE --- for back-combatibility, we don't have to check ExecCGI
***************
*** 142,148 ****
       * NB only ISINDEX scripts get decoded arguments.
       */
      
!     cleanup_for_exec();
      
  #ifdef __EMX__    
      if((!r->args) || (!r->args[0]) || (ind(r->args,'=') >= 0)) {
--- 143,150 ----
       * NB only ISINDEX scripts get decoded arguments.
       */
      
!     if (standalone)
!       cleanup_for_exec();
      
  #ifdef __EMX__    
      if((!r->args) || (!r->args[0]) || (ind(r->args,'=') >= 0)) {


-- Alexei Kosut <ak...@organic.com>            The Apache HTTP Server 
   http://www.nueva.pvt.k12.ca.us/~akosut/      http://www.apache.org/