You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2009/09/17 01:51:41 UTC

svn commit: r816011 - in /httpd/mod_fcgid/trunk: CHANGES-FCGID README-FCGID modules/fcgid/fcgid_conf.c modules/fcgid/fcgid_conf.h

Author: trawick
Date: Wed Sep 16 23:51:41 2009
New Revision: 816011

URL: http://svn.apache.org/viewvc?rev=816011&view=rev
Log:
Merge mod_fcgid server config/virtual host directives so that they can
be inherited or overridden within a virtual host as expected.

Affected directives:
  BusyTimeout, IPCCommTimeout, IPCConnectTimeout, MaxRequestInMem, 
  MaxRequestLen, MaxRequestsPerProcess, OutputBufferSize

Modified:
    httpd/mod_fcgid/trunk/CHANGES-FCGID
    httpd/mod_fcgid/trunk/README-FCGID
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h

Modified: httpd/mod_fcgid/trunk/CHANGES-FCGID
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/CHANGES-FCGID?rev=816011&r1=816010&r2=816011&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] (original)
+++ httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] Wed Sep 16 23:51:41 2009
@@ -1,6 +1,12 @@
                                                          -*- coding: utf-8 -*-
 Changes with mod_fcgid 2.3.2
 
+  *) Merge mod_fcgid server config/virtual host directives so that they can
+     be inherited or overridden within a virtual host as expected.  Affected
+     directives: BusyTimeout, IPCCommTimeout, IPCConnectTimeout, 
+     MaxRequestInMem, MaxRequestLen, MaxRequestsPerProcess, OutputBufferSize.
+     [Jeff Trawick]
+
   *) Use the virtual host settings for the request being processed instead
      of those of the first FastCGI request handled by this httpd child process.
      Affected directives: BusyTimeout, IPCCommTimeout, IPCConnectTimeout,

Modified: httpd/mod_fcgid/trunk/README-FCGID
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/README-FCGID?rev=816011&r1=816010&r2=816011&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/README-FCGID (original)
+++ httpd/mod_fcgid/trunk/README-FCGID Wed Sep 16 23:51:41 2009
@@ -140,9 +140,14 @@
    ignored before now result in configuration errors.  As before, these 
    directives must be set at global scope to have the desired effect.
    These include IdleTimeout, MaxProcessCount, PHP_Fix_Pathinfo_Enable,
-   ProcessLifetime, and others.  (Consult CHANGES_FCGID for the complete
+   ProcessLifetime, and others.  (Consult CHANGES-FCGID for the complete
    list.)
 
+ii. 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 IPCCommTimeout, OutputBufferSize, and others.
+    (Consult CHANGES-FCGID for the complete list.)
 
 Acknowledgements
 ----------------

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=816011&r1=816010&r2=816011&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c Wed Sep 16 23:51:41 2009
@@ -53,93 +53,97 @@
 #define DEFAULT_WRAPPER_KEY "ALL"
 #define WRAPPER_FLAG_VIRTUAL "virtual"
 
-static void init_server_config(apr_pool_t * p, fcgid_server_conf * config)
+void *create_fcgid_server_config(apr_pool_t * p, server_rec * s)
 {
+    fcgid_server_conf *config = apr_pcalloc(p, sizeof(*config));
+
+    if (!s->is_virtual) {
+        config->busy_scan_interval = DEFAULT_BUSY_SCAN_INTERVAL;
+        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);
+        config->spawn_score = DEFAULT_SPAWN_SCORE;
+        config->spawnscore_uplimit = DEFAULT_SPAWNSOCRE_UPLIMIT;
+        config->termination_score = DEFAULT_TERMINATION_SCORE;
+        config->time_score = DEFAULT_TIME_SCORE;
+        config->zombie_scan_interval = DEFAULT_ZOMBIE_SCAN_INTERVAL;
+    }
     /* Redundant; pcalloc creates this structure;
      * config->default_init_env = NULL;
      * config->pass_headers = NULL;
      * config->php_fix_pathinfo_enable = 0;
+     * config->*_set = 0;
      */
-    config->sockname_prefix =
-        ap_server_root_relative(p, DEFAULT_SOCKET_PREFIX);
-    config->shmname_path = ap_server_root_relative(p, DEFAULT_SHM_PATH);
-    config->idle_timeout = DEFAULT_IDLE_TIMEOUT;
-    config->idle_scan_interval = DEFAULT_IDLE_SCAN_INTERVAL;
-    config->busy_scan_interval = DEFAULT_BUSY_SCAN_INTERVAL;
-    config->proc_lifetime = DEFAULT_PROC_LIFETIME;
-    config->error_scan_interval = DEFAULT_ERROR_SCAN_INTERVAL;
-    config->zombie_scan_interval = DEFAULT_ZOMBIE_SCAN_INTERVAL;
-    config->spawn_score = DEFAULT_SPAWN_SCORE;
-    config->spawnscore_uplimit = DEFAULT_SPAWNSOCRE_UPLIMIT;
-    config->termination_score = DEFAULT_TERMINATION_SCORE;
-    config->time_score = DEFAULT_TIME_SCORE;
-    config->max_class_process_count = DEFAULT_MAX_CLASS_PROCESS_COUNT;
-    config->min_class_process_count = DEFAULT_MIN_CLASS_PROCESS_COUNT;
-    config->max_process_count = DEFAULT_MAX_PROCESS_COUNT;
-    config->output_buffersize = DEFAULT_OUTPUT_BUFFERSIZE;
+    config->busy_timeout = DEFAULT_BUSY_TIMEOUT;
     config->ipc_comm_timeout = DEFAULT_IPC_COMM_TIMEOUT;
     config->ipc_connect_timeout = DEFAULT_IPC_CONNECT_TIMEOUT;
-    config->busy_timeout = DEFAULT_BUSY_TIMEOUT;
-    config->max_requests_per_process = DEFAULT_MAX_REQUESTS_PER_PROCESS;
-    config->max_request_len = DEFAULT_MAX_REQUEST_LEN;
     config->max_mem_request_len = DEFAULT_MAX_MEM_REQUEST_LEN;
-}
-
-void *create_fcgid_server_config(apr_pool_t * p, server_rec * s)
-{
-    fcgid_server_conf *config = apr_pcalloc(p, sizeof(*config));
+    config->max_request_len = DEFAULT_MAX_REQUEST_LEN;
+    config->max_requests_per_process = DEFAULT_MAX_REQUESTS_PER_PROCESS;
+    config->output_buffersize = DEFAULT_OUTPUT_BUFFERSIZE;
 
-    init_server_config(p, config);
     return config;
 }
 
+#define MERGE_SCALAR(base, local, merged, field) \
+  if (!(local)->field##_set) { \
+      merged->field = base->field; \
+  }
+
 void *merge_fcgid_server_config(apr_pool_t * p, void *basev, void *locv)
 {
-    fcgid_server_conf *merged_config =
-        (fcgid_server_conf *) apr_pcalloc(p, sizeof(fcgid_server_conf));
     fcgid_server_conf *base = (fcgid_server_conf *) basev;
     fcgid_server_conf *local = (fcgid_server_conf *) locv;
-
-    init_server_config(p, merged_config);
+    fcgid_server_conf *merged =
+      (fcgid_server_conf *) apr_pmemdup(p, local, sizeof(fcgid_server_conf));
 
     /* Merge environment variables */
-    if (local->default_init_env != NULL || base->default_init_env != NULL) {
-        if (local->default_init_env == NULL)
-            merged_config->default_init_env = base->default_init_env;
-        else if (base->default_init_env == NULL)
-            merged_config->default_init_env = local->default_init_env;
-        else {
-            merged_config->default_init_env = 
-                apr_table_copy(p, base->default_init_env);
-            apr_table_overlap(merged_config->default_init_env, 
-                              local->default_init_env,
-                              APR_OVERLAP_TABLES_SET);
-        }
+    if (base->default_init_env == NULL) {
+        /* merged already set to local */
+    }
+    else if (local->default_init_env == NULL) {
+        merged->default_init_env = base->default_init_env;
+    }
+    else {
+        merged->default_init_env = 
+          apr_table_copy(p, base->default_init_env);
+        apr_table_overlap(merged->default_init_env, 
+                          local->default_init_env,
+                          APR_OVERLAP_TABLES_SET);
     }
 
     /* Merge pass headers */
-    if (local->pass_headers != NULL || base->pass_headers != NULL) {
-        if (local->pass_headers == NULL)
-            merged_config->pass_headers = base->pass_headers;
-        else if (base->pass_headers == NULL)
-            merged_config->pass_headers = local->pass_headers;
-        else
-            merged_config->pass_headers = apr_array_append(p, 
-                                              base->pass_headers,
-                                              local->pass_headers);
-    }
-
-    /* Merge the other configurations */
-    merged_config->ipc_comm_timeout = base->ipc_comm_timeout;
-    merged_config->ipc_comm_timeout = local->ipc_comm_timeout;
-
-    merged_config->ipc_connect_timeout = base->ipc_connect_timeout;
-    merged_config->ipc_connect_timeout = local->ipc_connect_timeout;
-
-    merged_config->busy_timeout = base->busy_timeout;
-    merged_config->busy_timeout = local->busy_timeout;
+    if (base->pass_headers == NULL) {
+        /* merged already set to local */
+    }
+    else if (local->pass_headers == NULL) {
+        merged->pass_headers = base->pass_headers;
+    }
+    else {
+        merged->pass_headers = 
+          apr_array_append(p, 
+                           base->pass_headers,
+                           local->pass_headers);
+    }
+
+    /* Merge the scalar settings */
+
+    MERGE_SCALAR(base, local, merged, busy_timeout);
+    MERGE_SCALAR(base, local, merged, ipc_comm_timeout);
+    MERGE_SCALAR(base, local, merged, ipc_connect_timeout);
+    MERGE_SCALAR(base, local, merged, max_mem_request_len);
+    MERGE_SCALAR(base, local, merged, max_request_len);
+    MERGE_SCALAR(base, local, merged, max_requests_per_process);
+    MERGE_SCALAR(base, local, merged, output_buffersize);
 
-    return merged_config;
+    return merged;
 }
 
 void *create_fcgid_dir_config(apr_pool_t * p, char *dummy)
@@ -207,6 +211,7 @@
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
     config->busy_timeout = atol(arg);
+    config->busy_timeout_set = 1;
     return NULL;
 }
 
@@ -393,6 +398,7 @@
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
     config->max_request_len = atol(arg);
+    config->max_request_len_set = 1;
     return NULL;
 }
 
@@ -410,6 +416,7 @@
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
     config->max_mem_request_len = atol(arg);
+    config->max_mem_request_len_set = 1;
     return NULL;
 }
 
@@ -517,6 +524,7 @@
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
     config->output_buffersize = atol(arg);
+    config->output_buffersize_set = 1;
     return NULL;
 }
 
@@ -598,6 +606,7 @@
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
     config->max_requests_per_process = atol(arg);
+    config->max_requests_per_process_set = 1;
     return NULL;
 }
 
@@ -623,6 +632,7 @@
     fcgid_server_conf *config =
         ap_get_module_config(s->module_config, &fcgid_module);
     config->ipc_connect_timeout = atol(arg);
+    config->ipc_connect_timeout_set = 1;
     return NULL;
 }
 
@@ -644,6 +654,7 @@
     if (config->ipc_comm_timeout < 0) {
         return "IPCCommTimeout must be greater than 0";
     }
+    config->ipc_comm_timeout_set = 1;
     return NULL;
 }
 

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=816011&r1=816010&r2=816011&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h Wed Sep 16 23:51:41 2009
@@ -79,17 +79,26 @@
     int termination_score;
     int time_score;
     int zombie_scan_interval;
-    /* global or vhost */
+    /* global or vhost
+     * scalar values have corresponding _set field to aid merging
+     */
     int busy_timeout; /* TODO: Does setting this in a vhost work as expected?
                        * Look at use in PM vs. handler.
                        */
+    int busy_timeout_set;
     apr_table_t *default_init_env;
     int ipc_comm_timeout;
+    int ipc_comm_timeout_set;
     int ipc_connect_timeout;
+    int ipc_connect_timeout_set;
     int max_mem_request_len;
+    int max_mem_request_len_set;
     int max_request_len;
+    int max_request_len_set;
     int max_requests_per_process;
+    int max_requests_per_process_set;
     int output_buffersize;
+    int output_buffersize_set;
     apr_array_header_t *pass_headers;
 } fcgid_server_conf;