httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r821608 - in /httpd/mod_fcgid/trunk: ./ docs/manual/mod/ modules/fcgid/
Date Sun, 04 Oct 2009 20:44:40 GMT
Author: trawick
Date: Sun Oct  4 20:44:39 2009
New Revision: 821608

URL: http://svn.apache.org/viewvc?rev=821608&view=rev
Log:
Allow/respect virtual host settings for the following directives:
FCGIDBusyTimeout, FCGIDDefaultMaxClassProcessCount, 
FCGIDDefaultMinClassProcessCount, FCGIDIdleTimeout, and 
FCGIDProcessLifetime.

Prior to r815897 they were allowed in a virtual host but ignored
since the PM had no way to see them.  Now a fcgid_cmd_options
structure with this information is passed to the PM.  (Existing
initial env settings, already passed to the PM, now reside in
this structure too.)

Modified:
    httpd/mod_fcgid/trunk/CHANGES-FCGID
    httpd/mod_fcgid/trunk/README-FCGID
    httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c

Modified: httpd/mod_fcgid/trunk/CHANGES-FCGID
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/CHANGES-FCGID?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] (original)
+++ httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] Sun Oct  4 20:44:39 2009
@@ -1,7 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with mod_fcgid 2.3.3
 
-
+  *) Allow/respect virtual host settings for the following directives:
+     FCGIDBusyTimeout, FCGIDDefaultMaxClassProcessCount, 
+     FCGIDDefaultMinClassProcessCount, FCGIDIdleTimeout, and 
+     FCGIDProcessLifetime.  [Jeff Trawick]
 
 Changes with mod_fcgid 2.3.2
 

Modified: httpd/mod_fcgid/trunk/README-FCGID
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/README-FCGID?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/README-FCGID (original)
+++ httpd/mod_fcgid/trunk/README-FCGID Sun Oct  4 20:44:39 2009
@@ -145,17 +145,21 @@
 ii.  Some directives which could be placed inside <VirtualHost > but were
      ignored before now result in configuration errors.  As before, these 
      directives must be set at global scope to have the desired effect.
-     These include FCGIDIdleTimeout, FCGIDMaxProcessCount, FCGIDPHPFixPathinfoEnable,
-     FCGIDProcessLifetime, and others.  (Consult CHANGES-FCGID for the complete
+     These include FCGIDMaxProcessCount, FCGIDPHPFixPathinfoEnable, and
+     others.  (Consult CHANGES-FCGID for the complete list.)
+
+iii. Some directives which could be placed inside <VirtualHost > but were
+     ignored before are now respected.  These include FCGIDIdleTimeout,
+     FCGIDProcessLifeTime, and others.  (Consult CHANGES-FCGID for the complete
      list.)
 
-iii. Some directives which can optionally be placed inside <VirtualHost >
+iv.  Some directives which can optionally be placed inside <VirtualHost >
      were not inherited as expected in older releases.  This has been
      corrected, and behavior will change for some configurations.  Affected
      directives include FCGIDIPCCommTimeout, FCGIDOutputBufferSize, and others.
      (Consult CHANGES-FCGID for the complete list.)
 
-iv.  Some directives which can be placed inside <Directory >, <Location >,
+v.   Some directives which can be placed inside <Directory >, <Location >,
      etc. were not inherited as expected in older releases.  This has been
      corrected, and behavior will change for some configurations.  Affected
      directives include FCGIDWrapper and the AAA-related directives.  (Consult

Modified: httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml (original)
+++ httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml Sun Oct  4 20:44:39 2009
@@ -594,7 +594,7 @@
     <description>a FastCGI application will be killed after handling a request for
FCGIDBusyTimeout</description>
     <syntax>FCGIDBusyTimeout <em>seconds</em></syntax>
     <default>FCGIDBusyTimeout 300</default>
-    <contextlist><context>server config</context></contextlist>
+    <contextlist><context>server config</context> <context>virtual
host</context></contextlist>
     <usage>
       <p>This is the maximum time limit for request handling.  If a FastCGI
       request does not complete within FCGIDBusyTimeout seconds, it will be
@@ -626,7 +626,7 @@
     <description>Max process count of one class of FastCGI application</description>
     <syntax>FCGIDDefaultMaxClassProcessCount <em>value</em></syntax>
     <default>FCGIDDefaultMaxClassProcessCount 100</default>
-    <contextlist><context>server config</context></contextlist>
+    <contextlist><context>server config</context> <context>virtual
host</context></contextlist>
     <usage>
       <p>A process class is the set of processes which were started by the same
       command, and share certain other characteristics such as virtual host and
@@ -642,7 +642,7 @@
     <description>Min process count of one class of FastCGI application</description>
     <syntax>FCGIDDefaultMinClassProcessCount <em>value</em></syntax>
     <default>FCGIDDefaultMinClassProcessCount 3</default>
-    <contextlist><context>server config</context></contextlist>
+    <contextlist><context>server config</context> <context>virtual
host</context></contextlist>
     <usage>
       <p>A process class is the set of processes which were started by the same
       command, and share certain other characteristics such as virtual host and
@@ -687,7 +687,7 @@
     <description>An idle FastCGI application will be killed after FCGIDIdleTimeout</description>
     <syntax>FCGIDIdleTimeout <em>seconds</em></syntax>
     <default>FCGIDIdleTimeout 300</default>
-    <contextlist><context>server config</context></contextlist>
+    <contextlist><context>server config</context> <context>virtual
host</context></contextlist>
     <usage>
       <p>Application processes which have not handled a request for this 
       period of time will be terminated, if the number of processses for the
@@ -858,7 +858,7 @@
     <description>maximum FastCGI application process lifetime</description>
     <syntax>FCGIDProcessLifeTime <em>seconds</em></syntax>
     <default>FCGIDProcessLifeTime 3600</default>
-    <contextlist><context>server config</context></contextlist>
+    <contextlist><context>server config</context> <context>virtual
host</context></contextlist>
     <usage>
       <p>Idle application processes which have existed for greater
       than this time will be terminated, if the number of processses for the

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_bridge.c Sun Oct  4 20:44:39 2009
@@ -184,7 +184,9 @@
          */
         int dt = (int)
             (apr_time_sec(apr_time_now()) - apr_time_sec(ctx->active_time));
-        if (dt > sconf->busy_timeout) {
+        if (dt > sconf->busy_timeout) { /* can't reference from procnode->cmdopts
+                                         * because procnode could have been reused
+                                         */
             /* Do nothing but print log */
             ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
                           "mod_fcgid: process busy timeout (%d), took %d seconds for this
request",

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c Sun Oct  4 20:44:39 2009
@@ -59,14 +59,9 @@
 
     if (!s->is_virtual) {
         config->busy_scan_interval = DEFAULT_BUSY_SCAN_INTERVAL;
-        config->busy_timeout = DEFAULT_BUSY_TIMEOUT;
-        config->max_class_process_count = DEFAULT_MAX_CLASS_PROCESS_COUNT;
-        config->min_class_process_count = DEFAULT_MIN_CLASS_PROCESS_COUNT;
         config->error_scan_interval = DEFAULT_ERROR_SCAN_INTERVAL;
         config->idle_scan_interval = DEFAULT_IDLE_SCAN_INTERVAL;
-        config->idle_timeout = DEFAULT_IDLE_TIMEOUT;
         config->max_process_count = DEFAULT_MAX_PROCESS_COUNT;
-        config->proc_lifetime = DEFAULT_PROC_LIFETIME;
         config->shmname_path = ap_server_root_relative(p, DEFAULT_SHM_PATH);
         config->sockname_prefix =
           ap_server_root_relative(p, DEFAULT_SOCKET_PREFIX);
@@ -88,6 +83,11 @@
     config->max_request_len = DEFAULT_MAX_REQUEST_LEN;
     config->max_requests_per_process = DEFAULT_MAX_REQUESTS_PER_PROCESS;
     config->output_buffersize = DEFAULT_OUTPUT_BUFFERSIZE;
+    config->max_class_process_count = DEFAULT_MAX_CLASS_PROCESS_COUNT;
+    config->min_class_process_count = DEFAULT_MIN_CLASS_PROCESS_COUNT;
+    config->busy_timeout = DEFAULT_BUSY_TIMEOUT;
+    config->idle_timeout = DEFAULT_IDLE_TIMEOUT;
+    config->proc_lifetime = DEFAULT_PROC_LIFETIME;
 
     return config;
 }
@@ -133,9 +133,6 @@
                            local->pass_headers);
     }
 
-    /* FIXME See BZ #47483 */
-    merged->busy_timeout = base->busy_timeout;
-
     /* Merge the scalar settings */
 
     MERGE_SCALAR(base, local, merged, ipc_comm_timeout);
@@ -144,6 +141,11 @@
     MERGE_SCALAR(base, local, merged, max_request_len);
     MERGE_SCALAR(base, local, merged, max_requests_per_process);
     MERGE_SCALAR(base, local, merged, output_buffersize);
+    MERGE_SCALAR(base, local, merged, max_class_process_count);
+    MERGE_SCALAR(base, local, merged, min_class_process_count);
+    MERGE_SCALAR(base, local, merged, busy_timeout);
+    MERGE_SCALAR(base, local, merged, idle_timeout);
+    MERGE_SCALAR(base, local, merged, proc_lifetime);
 
     return merged;
 }
@@ -197,13 +199,9 @@
     server_rec *s = cmd->server;
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-
-    if (err != NULL) {
-        return err;
-    }
 
     config->idle_timeout = atol(arg);
+    config->idle_timeout_set = 1;
     return NULL;
 }
 
@@ -228,13 +226,9 @@
     server_rec *s = cmd->server;
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-
-    if (err != NULL) {
-        return err;
-    }
 
     config->busy_timeout = atol(arg);
+    config->busy_timeout_set = 1;
     return NULL;
 }
 
@@ -260,13 +254,9 @@
     server_rec *s = cmd->server;
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-
-    if (err != NULL) {
-        return err;
-    }
 
     config->proc_lifetime = atol(arg);
+    config->proc_lifetime_set = 1;
     return NULL;
 }
 
@@ -476,13 +466,9 @@
     server_rec *s = cmd->server;
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-
-    if (err != NULL) {
-        return err;
-    }
 
     config->max_class_process_count = atol(arg);
+    config->max_class_process_count_set = 1;
     return NULL;
 }
 
@@ -492,13 +478,9 @@
     server_rec *s = cmd->server;
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
-    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
-
-    if (err != NULL) {
-        return err;
-    }
 
     config->min_class_process_count = atol(arg);
+    config->min_class_process_count_set = 1;
     return NULL;
 }
 
@@ -575,13 +557,6 @@
     return NULL;
 }
 
-apr_table_t *get_default_env_vars(request_rec * r)
-{
-    fcgid_server_conf *config =
-        ap_get_module_config(r->server->module_config, &fcgid_module);
-    return config->default_init_env;
-}
-
 const char *add_pass_headers(cmd_parms * cmd, void *dummy,
                              const char *names)
 {
@@ -879,3 +854,49 @@
 
     return NULL;
 }
+
+void get_cmd_options(request_rec *r, fcgid_cmd_options *cmdopts)
+{
+    fcgid_server_conf *sconf =
+        ap_get_module_config(r->server->module_config, &fcgid_module);
+    apr_table_t *initenv = sconf->default_init_env;
+    const apr_array_header_t *initenv_arr;
+    const apr_table_entry_t *initenv_entry;
+    int i;
+    
+    cmdopts->busy_timeout = sconf->busy_timeout;
+    cmdopts->idle_timeout = sconf->idle_timeout;
+    cmdopts->max_class_process_count = sconf->max_class_process_count;
+    cmdopts->min_class_process_count = sconf->min_class_process_count;
+    cmdopts->proc_lifetime = sconf->proc_lifetime;
+
+    /* Environment variables */
+    if (initenv) {
+        initenv_arr = apr_table_elts(initenv);
+        initenv_entry = (apr_table_entry_t *) initenv_arr->elts;
+        if (initenv_arr->nelts > INITENV_CNT) {
+            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
+                          "mod_fcgid: %d environment variables dropped; increase "
+                          "INITENV_CNT in fcgid_pm.h from %d to at least %d",
+                          initenv_arr->nelts - INITENV_CNT,
+                          INITENV_CNT,
+                          initenv_arr->nelts);
+        }
+
+        for (i = 0; i < initenv_arr->nelts && i < INITENV_CNT; ++i) {
+            if (initenv_entry[i].key == NULL
+                || initenv_entry[i].key[0] == '\0')
+                break;
+            apr_cpystrn(cmdopts->initenv_key[i], initenv_entry[i].key,
+                        INITENV_KEY_LEN);
+            apr_cpystrn(cmdopts->initenv_val[i], initenv_entry[i].val,
+                        INITENV_VAL_LEN);
+        }
+        if (i < INITENV_CNT) {
+            cmdopts->initenv_key[i][0] = '\0';
+        }
+    }
+    else {
+        cmdopts->initenv_key[0][0] = '\0';
+    }
+}

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h Sun Oct  4 20:44:39 2009
@@ -64,15 +64,10 @@
 typedef struct {
     /* global only */
     int busy_scan_interval;
-    int busy_timeout;
-    int max_class_process_count;
-    int min_class_process_count;
     int error_scan_interval;
     int idle_scan_interval;
-    int idle_timeout;
     int max_process_count;
     int php_fix_pathinfo_enable;
-    int proc_lifetime;
     char *shmname_path;
     char *sockname_prefix;
     int spawn_score;
@@ -97,6 +92,16 @@
     int output_buffersize;
     int output_buffersize_set;
     apr_array_header_t *pass_headers;
+    int max_class_process_count;
+    int max_class_process_count_set;
+    int min_class_process_count;
+    int min_class_process_count_set;
+    int busy_timeout;
+    int busy_timeout_set;
+    int idle_timeout;
+    int idle_timeout_set;
+    int proc_lifetime;
+    int proc_lifetime_set;
 } fcgid_server_conf;
 
 typedef struct {
@@ -121,6 +126,20 @@
     int access_authoritative_set;
 } fcgid_dir_conf;
 
+/* processing options which are sent to the PM with a spawn request */
+#define INITENV_KEY_LEN 64
+#define INITENV_VAL_LEN 128
+#define INITENV_CNT 64
+typedef struct {
+    int busy_timeout;
+    int idle_timeout;
+    int max_class_process_count;
+    int min_class_process_count;
+    int proc_lifetime;
+    char initenv_key[INITENV_CNT][INITENV_KEY_LEN];
+    char initenv_val[INITENV_CNT][INITENV_VAL_LEN];
+} fcgid_cmd_options;
+
 void *create_fcgid_server_config(apr_pool_t * p, server_rec * s);
 void *merge_fcgid_server_config(apr_pool_t * p, void *basev,
                                 void *overridesv);
@@ -189,7 +208,6 @@
 
 const char *add_default_env_vars(cmd_parms * cmd, void *sconf,
                                  const char *name, const char *value);
-apr_table_t *get_default_env_vars(request_rec * r);
 
 const char *add_pass_headers(cmd_parms * cmd, void *sconf,
                              const char *name);
@@ -224,6 +242,8 @@
 const char *set_max_requests_per_process(cmd_parms * cmd, void *dummy,
                                          const char *arg);
 
+void get_cmd_options(request_rec *r, fcgid_cmd_options *cmdopts);
+
 AP_MODULE_DECLARE_DATA extern module fcgid_module;
 
 #endif

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm.h Sun Oct  4 20:44:39 2009
@@ -18,9 +18,7 @@
 #ifndef FCGID_PM_H
 #define FCGID_PM_H
 #include "fcgid_global.h"
-#define INITENV_KEY_LEN 64
-#define INITENV_VAL_LEN 128
-#define INITENV_CNT 64
+#include "fcgid_conf.h"
 
 typedef struct {
     char cgipath[_POSIX_PATH_MAX];
@@ -32,8 +30,7 @@
     uid_t uid;                  /* For suEXEC */
     gid_t gid;                  /* For suEXEC */
     int userdir;                /* For suEXEC */
-    char initenv_key[INITENV_CNT][INITENV_KEY_LEN];
-    char initenv_val[INITENV_CNT][INITENV_VAL_LEN];
+    fcgid_cmd_options cmdopts;  /* context-specific configuration */
 } fcgid_command;
 
 void procmgr_init_spawn_cmd(fcgid_command * command, request_rec * r,

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_main.c Sun Oct  4 20:44:39 2009
@@ -53,14 +53,14 @@
     fcgid_procnode *proc_table;
     apr_time_t last_active_time, start_time;
     apr_time_t now = apr_time_now();
+    int idle_timeout, proc_lifetime;
     fcgid_server_conf *sconf = ap_get_module_config(main_server->module_config,
                                                     &fcgid_module);
 
     /* Should I check the idle list now? */
     if (procmgr_must_exit()
         || apr_time_sec(now) - apr_time_sec(lastidlescan) <=
-        sconf->idle_scan_interval
-        || (!sconf->idle_timeout && !sconf->proc_lifetime))
+        sconf->idle_scan_interval)
         return;
     lastidlescan = now;
 
@@ -75,17 +75,19 @@
         next_node = &proc_table[current_node->next_index];
         last_active_time = current_node->last_active_time;
         start_time = current_node->start_time;
-        if (((sconf->idle_timeout && 
-              (apr_time_sec(now) - apr_time_sec(last_active_time) > sconf->idle_timeout))
-             || (sconf->proc_lifetime && 
-              (apr_time_sec(now) - apr_time_sec(start_time) > sconf->proc_lifetime)))
+        idle_timeout = current_node->cmdopts.idle_timeout;
+        proc_lifetime = current_node->cmdopts.proc_lifetime;
+        if (((idle_timeout && 
+              (apr_time_sec(now) - apr_time_sec(last_active_time) > idle_timeout))
+             || (proc_lifetime && 
+              (apr_time_sec(now) - apr_time_sec(start_time) > proc_lifetime)))
             && is_kill_allowed(main_server, current_node)) {
             /* Set die reason for log */
-            if (sconf->idle_timeout &&
-                (apr_time_sec(now) - apr_time_sec(last_active_time) > sconf->idle_timeout))
+            if (idle_timeout &&
+                (apr_time_sec(now) - apr_time_sec(last_active_time) > idle_timeout))
                 current_node->diewhy = FCGID_DIE_IDLE_TIMEOUT;
-            else if (sconf->proc_lifetime && 
-                     (apr_time_sec(now) - apr_time_sec(start_time) > sconf->proc_lifetime))
+            else if (proc_lifetime && 
+                     (apr_time_sec(now) - apr_time_sec(start_time) > proc_lifetime))
                 current_node->diewhy = FCGID_DIE_LIFETIME_EXPIRED;
 
             /* Unlink from idle list */
@@ -137,7 +139,7 @@
         last_active_time = current_node->last_active_time;
         /* FIXME See BZ #47483 */
         if (apr_time_sec(now) - apr_time_sec(last_active_time) >
-            (sconf->busy_timeout + 10)) {
+            (current_node->cmdopts.busy_timeout + 10)) {
             /* Set dir reason for log */
             current_node->diewhy = FCGID_DIE_BUSY_TIMEOUT;
 
@@ -495,6 +497,7 @@
     procnode->requests_handled = 0;
     procnode->diewhy = FCGID_DIE_KILLSELF;
     procnode->proc_pool = NULL;
+    procnode->cmdopts = command->cmdopts;
 
     procinfo.cgipath = command->cgipath;
     procinfo.configpool = configpool;
@@ -521,10 +524,10 @@
      */
     default_proc_env(procinfo.proc_environ);        
     for (i = 0; i < INITENV_CNT; i++) {
-        if (command->initenv_key[i][0] == '\0')
+        if (command->cmdopts.initenv_key[i][0] == '\0')
             break;
-        apr_table_set(procinfo.proc_environ, command->initenv_key[i],
-                      command->initenv_val[i]);
+        apr_table_set(procinfo.proc_environ, command->cmdopts.initenv_key[i],
+                      command->cmdopts.initenv_val[i]);
     }
 
     /* Spawn the process now */

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_unix.c Sun Oct  4 20:44:39 2009
@@ -388,11 +388,7 @@
                             apr_ino_t inode, apr_size_t share_grp_id)
 {
     ap_unix_identity_t *ugid;
-    apr_table_t *initenv;
-    const apr_array_header_t *initenv_arr;
-    const apr_table_entry_t *initenv_entry;
     fcgid_wrapper_conf *wrapperconf;
-    int i;
 
     memset(command, 0, sizeof(*command));
 
@@ -407,30 +403,6 @@
         command->userdir = 0;
     }
 
-    /* Environment variables */
-    initenv = get_default_env_vars(r);
-    if (initenv) {
-        initenv_arr = apr_table_elts(initenv);
-        initenv_entry = (apr_table_entry_t *) initenv_arr->elts;
-        if (initenv_arr->nelts > INITENV_CNT)
-            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
-                          "mod_fcgid: %d environment variables dropped; increase "
-                          "INITENV_CNT in fcgid_pm.h from %d to at least %d",
-                          initenv_arr->nelts - INITENV_CNT,
-                          INITENV_CNT,
-                          initenv_arr->nelts);
-
-        for (i = 0; i < initenv_arr->nelts && i < INITENV_CNT; ++i) {
-            if (initenv_entry[i].key == NULL
-                || initenv_entry[i].key[0] == '\0')
-                break;
-            apr_cpystrn(command->initenv_key[i], initenv_entry[i].key,
-                        INITENV_KEY_LEN);
-            apr_cpystrn(command->initenv_val[i], initenv_entry[i].val,
-                        INITENV_VAL_LEN);
-        }
-    }
-
     apr_cpystrn(command->cgipath, argv0, _POSIX_PATH_MAX);
     command->deviceid = deviceid;
     command->inode = inode;
@@ -445,6 +417,8 @@
         command->inode = wrapperconf->inode;
         command->share_grp_id = wrapperconf->share_group_id;
     }
+
+    get_cmd_options(r, &command->cmdopts);
 }
 
 apr_status_t procmgr_post_spawn_cmd(fcgid_command * command,

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_pm_win.c Sun Oct  4 20:44:39 2009
@@ -125,38 +125,10 @@
                             const char *argv0, dev_t deviceid,
                             apr_ino_t inode, apr_size_t share_grp_id)
 {
-    apr_table_t *initenv;
-    const apr_array_header_t *initenv_arr;
-    const apr_table_entry_t *initenv_entry;
     fcgid_wrapper_conf *wrapperconf;
-    int i;
 
     memset(command, 0, sizeof(*command));
 
-    /* Environment variables */
-    initenv = get_default_env_vars(r);
-    if (initenv) {
-        initenv_arr = apr_table_elts(initenv);
-        initenv_entry = (apr_table_entry_t *) initenv_arr->elts;
-        if (initenv_arr->nelts > INITENV_CNT)
-            ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
-                          "mod_fcgid: %d environment variables dropped; increase "
-                          "INITENV_CNT in fcgid_pm.h from %d to at least %d",
-                          initenv_arr->nelts - INITENV_CNT,
-                          INITENV_CNT,
-                          initenv_arr->nelts);
-
-        for (i = 0; i < initenv_arr->nelts && i < INITENV_CNT; ++i) {
-            if (initenv_entry[i].key == NULL
-                || initenv_entry[i].key[0] == '\0')
-                break;
-            apr_cpystrn(command->initenv_key[i], initenv_entry[i].key,
-                        INITENV_KEY_LEN);
-            apr_cpystrn(command->initenv_val[i], initenv_entry[i].val,
-                        INITENV_VAL_LEN);
-        }
-    }
-
     apr_cpystrn(command->cgipath, argv0, _POSIX_PATH_MAX);
     command->deviceid = deviceid;
     command->inode = inode;
@@ -174,6 +146,8 @@
         command->inode = wrapperconf->inode;
         command->share_grp_id = wrapperconf->share_group_id;
     }
+
+    get_cmd_options(r, &command->cmdopts);
 }
 
 apr_status_t procmgr_post_spawn_cmd(fcgid_command * command,

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_proctbl.h Sun Oct  4 20:44:39 2009
@@ -21,6 +21,7 @@
 #include "httpd.h"
 #include "apr_thread_proc.h"
 #include "fcgid_global.h"
+#include "fcgid_conf.h"
 
 /* Increase it if necessary */
 #define FCGID_MAX_APPLICATION (1024)
@@ -50,6 +51,7 @@
     apr_time_t last_active_time;    /* the time this process last active */
     int requests_handled;       /* number of requests process has handled */
     char diewhy;                /* why it die */
+    fcgid_cmd_options cmdopts;  /* context-specific configuration */
 } fcgid_procnode;
 
 /* Macros for diewhy */

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c?rev=821608&r1=821607&r2=821608&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_spawn_ctl.c Sun Oct  4 20:44:39 2009
@@ -29,6 +29,8 @@
     const char *virtualhost;
     int score;
     int process_counter;
+    int max_class_process_count;
+    int min_class_process_count;
     apr_time_t last_stat_time;
     struct fcgid_stat_node *next;
 };
@@ -97,6 +99,10 @@
         current_node->last_stat_time = apr_time_now();
         current_node->score = 0;
         current_node->process_counter = 1;
+        current_node->max_class_process_count =
+            procnode->cmdopts.max_class_process_count;
+        current_node->min_class_process_count =
+            procnode->cmdopts.min_class_process_count;
         current_node->next = NULL;
 
         /* append it to stat list for next search */
@@ -195,11 +201,11 @@
            Process count of this class higher than up limit?
          */
         /* I need max class proccess count */
-        if (current_node->process_counter >= sconf->max_class_process_count) {
+        if (current_node->process_counter >= current_node->max_class_process_count)
{
             ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, main_server,
                          "mod_fcgid: too many %s processes (current:%d, max:%d), skip the
spawn request",
                          command->cgipath, current_node->process_counter,
-                         sconf->max_class_process_count);
+                         current_node->max_class_process_count);
             return 0;
         }
 
@@ -232,7 +238,7 @@
 
     if (current_node) {
         /* Found the node */
-        if (current_node->process_counter <= sconf->min_class_process_count)
+        if (current_node->process_counter <= current_node->min_class_process_count)
             return 0;
     }
 



Mime
View raw message