httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul J. Reder" <rede...@raleigh.ibm.com>
Subject [Patch]: Get mod_cgid working.
Date Fri, 26 May 2000 22:21:49 GMT
The attached patch fixes a few small mod_cgid problems. Most are
just macro changes. A couple are related to changes function parms.
Moving the ap_destroy_pool call fixes a core dump on the second cgi
to be run (the pool was being destroyed too soon).

Preliminary test results show doubled performance when using mod_cgid 
over mod_cgi on Linux. I will be running a larger set of tests with
a variety of parms to get a better idea of the results.

-- 

Paul J. Reder

---------------------------------------------------------------------
Noise proves nothing.  Often a hen who has merely laid an egg cackles
as if she laid an asteroid.
		-- Mark Twain
(An apt quote in this political season.)



Index: mod_cgid.c
===================================================================
RCS file: /home/cvspublic/apache-2.0/src/modules/standard/mod_cgid.c,v
retrieving revision 1.9
diff -u -r1.9 mod_cgid.c
--- mod_cgid.c	2000/05/04 04:02:36	1.9
+++ mod_cgid.c	2000/05/26 22:09:09
@@ -127,6 +127,8 @@
 #define DEFAULT_BUFBYTES 1024 
 #define DEFAULT_SOCKET "logs/cgisock"
 
+#define SHELL_PATH "/bin/sh"
+
 typedef struct { 
     const char *sockname;
     char *logname; 
@@ -302,14 +304,16 @@
 #ifdef APR_HAS_OTHER_CHILD
     int *sd = data;
     switch (reason) {
-        case OC_REASON_DEATH:
-        case OC_REASON_LOST:
+        case APR_OC_REASON_DEATH:
+        case APR_OC_REASON_LOST:
             /* stop gap to make sure everything else works.  In the end,
-             * we'll just restart the cgid server. */   
+             * we'll just restart the cgid server. */
+            ap_destroy_pool(pcgi);
             kill(getppid(), SIGWINCH);
             break;
-        case OC_REASON_RESTART:
-        case OC_REASON_UNREGISTER:
+        case APR_OC_REASON_RESTART:
+        case APR_OC_REASON_UNREGISTER:
+            ap_destroy_pool(pcgi);
             kill(*sd, SIGHUP);
             break;
     }
@@ -321,7 +325,6 @@
     int i, len, j; 
     unsigned char *data; 
     char **environ; 
-    char temp[MAX_STRING_LEN]; 
     core_dir_config *temp_core; 
     void **dconf; 
 
@@ -397,11 +400,8 @@
 static void send_req(int fd, request_rec *r, char *argv0, char **env) 
 { 
     int len; 
-    int rv;
     int i = 0; 
     char *data; 
-    core_dir_config *conf = ap_get_module_config(r->per_dir_config, 
-                                                 &core_module); 
 
     data = ap_pstrcat(r->pool, r->filename, "\n", argv0, "\n", r->uri, "\n", 
                      NULL); 
@@ -566,6 +566,7 @@
 static void cgid_init(ap_pool_t *p, ap_pool_t *plog, ap_pool_t *ptemp, server_rec *main_server)

 { 
     int pid; 
+    ap_proc_t ap_pid;
     int tempfd;
 
     cgid_server_conf *sconf = (cgid_server_conf *)ap_get_module_config( 
@@ -585,7 +586,9 @@
             exit(-1);
         } 
 #ifdef APR_HAS_OTHER_CHILD
-        ap_register_other_child(pid, cgid_maint, &pid, -1);
+        ap_pid.pid = pid;
+        ap_pid.err = ap_pid.in = ap_pid.out = NULL;
+        ap_register_other_child(&ap_pid, cgid_maint, NULL, NULL, p);
 #endif
     } 
     else once_through++; 
@@ -838,11 +841,11 @@
         } 
     } 
 #else 
-    if (r->finfo.st_mode == 0) 
+    if (r->finfo.protection == 0) 
         return log_scripterror(r, conf, NOT_FOUND, APLOG_NOERRNO, 
                                "script not found or unable to stat"); 
 #endif 
-    if (S_ISDIR(r->finfo.st_mode)) 
+    if (r->finfo.filetype == APR_DIR) 
         return log_scripterror(r, conf, FORBIDDEN, APLOG_NOERRNO, 
                                "attempt to invoke directory as script"); 
 /*
@@ -980,8 +983,6 @@
     if (script && nph) { 
         ap_send_fb(script, r); 
     } 
-
-ap_destroy_pool(pcgi);
 
     return OK; /* NOT r->status, even if it has changed. */ 
 }

Mime
View raw message