You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2009/09/11 21:26:34 UTC

svn commit: r813989 - in /httpd/mod_fcgid/trunk: docs/manual/mod/mod_fcgid.xml modules/fcgid/fcgid_conf.c

Author: rjung
Date: Fri Sep 11 19:26:29 2009
New Revision: 813989

URL: http://svn.apache.org/viewvc?rev=813989&view=rev
Log:
- document FCGIWrapper
- change implementation of FCGIWrapper a bit:
  allow use without the optional suffix argument
  which will define a default wrapper

Modified:
    httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c

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=813989&r1=813988&r2=813989&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml (original)
+++ httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.xml Fri Sep 11 19:26:29 2009
@@ -286,7 +286,7 @@
   <directivesynopsis>
     <name>FCGIWrapper</name>
     <description>The CGI wrapper setting</description>
-    <syntax>FCGIWrapper <em>command</em> [ <em>type</em> ]</syntax>
+    <syntax>FCGIWrapper <em>command</em> [ <em>suffix</em> ]</syntax>
     <default><em>none</em></default>
     <contextlist>
       <context>server config</context> <context>virtual host</context>
@@ -294,7 +294,14 @@
     </contextlist>
     <override>FileInfo</override>
     <usage>
-      <p>TODO</p>
+      <p>The given command is used to spawn FCGI server processes. If this directive
+      is not used, the file pointed to by the request URL will be used instead.</p>
+      <p>Options for the command can be included using quotation marks surrounding
+      the command and options. The optional <code>suffix</code> argument restricts
+      the use of this FCGI server to all URLs with the given exact path suffix.
+      A suffix needs to start with '<code>.</code>'.</p>
+      <p>The directive can be used multiply times. A wrapper defined without a suffix
+      is used as a default, in case no suffix matches.</p>
     </usage>
   </directivesynopsis>
 

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=813989&r1=813988&r2=813989&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c Fri Sep 11 19:26:29 2009
@@ -50,6 +50,7 @@
 #define DEFAULT_MAX_REQUESTS_PER_PROCESS -1
 #define DEFAULT_MAX_REQUEST_LEN (1024*1024*1024)    /* 1G */
 #define DEFAULT_MAX_MEM_REQUEST_LEN (1024*64)   /* 64k */
+#define DEFAULT_WRAPPER_KEY "ALL"
 
 static void init_server_config(apr_pool_t * p, fcgid_server_conf * config)
 {
@@ -766,20 +767,24 @@
     fcgid_wrapper_conf *wrapper = NULL;
     fcgid_dir_conf *config = (fcgid_dir_conf *) dirconfig;
 
-    /* Sanity check */
-    if (wrapperpath == NULL || extension == NULL
-        || *extension != '.' || *(extension + 1) == '\0'
-        || ap_strchr_c(extension, '/') || ap_strchr_c(extension, '\\'))
+    /* Sanity checks */
+
+    if (wrapperpath == NULL)
+        return "Invalid wrapper file";
+
+    if (extension != NULL
+        && (*extension != '.' || *(extension + 1) == '\0'
+            || ap_strchr_c(extension, '/') || ap_strchr_c(extension, '\\')))
         return "Invalid wrapper file extension";
 
-    /* Get wrapper_id base on wrapperpath */
+    /* Get wrapper_id hash from user data */
     {
         void *id_info_vp;
         apr_pool_userdata_get(&id_info_vp, userdata_key,
                               cmd->server->process->pool);
         id_info = id_info_vp;
     }
-    
+
     if (!id_info) {
         id_info =
             apr_pcalloc(cmd->server->process->pool, sizeof(*id_info));
@@ -789,6 +794,7 @@
                               apr_pool_cleanup_null,
                               cmd->server->process->pool);
     }
+    /* Get wrapper_id for wrapperpath */
     if ((wrapper_id =
          apr_hash_get(id_info->wrapper_id_hash, wrapperpath,
                       strlen(wrapperpath))) == NULL) {
@@ -807,11 +813,11 @@
     if (path == NULL || *path == '\0')
         return "Invalid wrapper config";
 
-    /* Is the wrapper exist? */
+    /* Does the wrapper exist? */
     if ((rv = apr_stat(&finfo, path, APR_FINFO_NORM,
                        cmd->temp_pool)) != APR_SUCCESS) {
         return apr_psprintf(cmd->pool,
-                            "can't get FastCGI file info: %s(%s), errno: %d",
+                            "can't get FastCGI file info: '%s' (%s), errno: %d",
                             wrapperpath, path, apr_get_os_error());
     }
 
@@ -821,7 +827,11 @@
     wrapper->share_group_id = *wrapper_id;
     (*wrapper_id)++;
 
+    if (extension == NULL)
+        extension = DEFAULT_WRAPPER_KEY;
+
     /* Add the node now */
+    /* If an extension is configured multiple times, the last directive wins. */
     apr_hash_set(config->wrapper_info_hash, extension, strlen(extension),
                  wrapper);
 
@@ -837,15 +847,19 @@
 
     /* Get file name extension */
     extension = ap_strrchr_c(cgipath, '.');
+
     if (extension == NULL)
-        return NULL;
+        extension = DEFAULT_WRAPPER_KEY;
 
     /* Search file name extension in per_dir_config */
-    if (config
-        && (wrapper =
-            apr_hash_get(config->wrapper_info_hash, extension,
-                         strlen(extension))))
+    if (config) {
+        wrapper = apr_hash_get(config->wrapper_info_hash, extension,
+                               strlen(extension));
+        if (wrapper == NULL)
+            wrapper = apr_hash_get(config->wrapper_info_hash, DEFAULT_WRAPPER_KEY,
+                                   strlen(DEFAULT_WRAPPER_KEY));
         return wrapper;
+    }
 
     return NULL;
 }