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 22:32:11 UTC

svn commit: r814017 - in /httpd/mod_fcgid/trunk: docs/manual/mod/mod_fcgid.html.en docs/manual/mod/mod_fcgid.xml modules/fcgid/fcgid_conf.c modules/fcgid/fcgid_conf.h modules/fcgid/mod_fcgid.c

Author: rjung
Date: Fri Sep 11 20:32:05 2009
New Revision: 814017

URL: http://svn.apache.org/viewvc?rev=814017&view=rev
Log:
Improve the use of virtual FCGI URLs:
by default we still want the URLs to point to existing
files. Using an optional "virtual" flag in the FCGIWrapper
directive one can allow the URLs being used symbolically.

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

Modified: httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.html.en
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.html.en?rev=814017&r1=814016&r2=814017&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.html.en (original)
+++ httpd/mod_fcgid/trunk/docs/manual/mod/mod_fcgid.html.en Fri Sep 11 20:32:05 2009
@@ -350,7 +350,7 @@
 <div class="directive-section"><h2><a name="FCGIWrapper" id="FCGIWrapper">FCGIWrapper</a> <a name="fcgiwrapper" id="fcgiwrapper">Directive</a></h2>
 <table class="directive">
 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>The CGI wrapper setting</td></tr>
-<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FCGIWrapper <em>command</em> [ <em>suffix</em> ]</code></td></tr>
+<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FCGIWrapper <em>command</em> [ <em>suffix</em> ] [ virtual ]</code></td></tr>
 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code><em>none</em></code></td></tr>
 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
@@ -358,13 +358,17 @@
 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_fcgid</td></tr>
 </table>
       <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>
+      is not used, the file pointed to by the request URL will be used instead.
+      Options for the command can be included using quotation marks surrounding
+      the command and options.</p>
+      <p>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 <code>virtual</code> flag signals, that there will be no check,
+      whether the request URL actually points to an existing file. The only
+      file which needs to exist is the wrapper itself.</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>
+      is used as a default in case no suffix matches.</p>
     
 </div>
 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>

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=814017&r1=814016&r2=814017&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 20:32:05 2009
@@ -286,7 +286,7 @@
   <directivesynopsis>
     <name>FCGIWrapper</name>
     <description>The CGI wrapper setting</description>
-    <syntax>FCGIWrapper <em>command</em> [ <em>suffix</em> ]</syntax>
+    <syntax>FCGIWrapper <em>command</em> [ <em>suffix</em> ] [ virtual ]</syntax>
     <default><em>none</em></default>
     <contextlist>
       <context>server config</context> <context>virtual host</context>
@@ -295,13 +295,17 @@
     <override>FileInfo</override>
     <usage>
       <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>
+      is not used, the file pointed to by the request URL will be used instead.
+      Options for the command can be included using quotation marks surrounding
+      the command and options.</p>
+      <p>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 <code>virtual</code> flag signals, that there will be no check,
+      whether the request URL actually points to an existing file. The only
+      file which needs to exist is the wrapper itself.</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>
+      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=814017&r1=814016&r2=814017&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.c Fri Sep 11 20:32:05 2009
@@ -51,6 +51,7 @@
 #define DEFAULT_MAX_REQUEST_LEN (1024*1024*1024)    /* 1G */
 #define DEFAULT_MAX_MEM_REQUEST_LEN (1024*64)   /* 64k */
 #define DEFAULT_WRAPPER_KEY "ALL"
+#define WRAPPER_FLAG_VIRTUAL "virtual"
 
 static void init_server_config(apr_pool_t * p, fcgid_server_conf * config)
 {
@@ -756,7 +757,8 @@
 
 const char *set_wrapper_config(cmd_parms * cmd, void *dirconfig,
                                const char *wrapperpath,
-                               const char *extension)
+                               const char *extension,
+                               const char *virtual)
 {
     const char *path, *tmp;
     apr_status_t rv;
@@ -772,6 +774,15 @@
     if (wrapperpath == NULL)
         return "Invalid wrapper file";
 
+    if (virtual == NULL && extension != NULL && !strcmp(extension, WRAPPER_FLAG_VIRTUAL)) {
+        virtual = "virtual";
+        extension = NULL;
+    }
+
+    if (virtual != NULL && strcmp(virtual, WRAPPER_FLAG_VIRTUAL)) {
+        return "Invalid wrapper flag";
+    }
+
     if (extension != NULL
         && (*extension != '.' || *(extension + 1) == '\0'
             || ap_strchr_c(extension, '/') || ap_strchr_c(extension, '\\')))
@@ -825,6 +836,7 @@
     wrapper->inode = finfo.inode;
     wrapper->deviceid = finfo.device;
     wrapper->share_group_id = *wrapper_id;
+    wrapper->virtual = (virtual != NULL && !strcmp(virtual, WRAPPER_FLAG_VIRTUAL));
     (*wrapper_id)++;
 
     if (extension == 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=814017&r1=814016&r2=814017&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_conf.h Fri Sep 11 20:32:05 2009
@@ -58,6 +58,7 @@
     apr_ino_t inode;
     apr_dev_t deviceid;
     apr_size_t share_group_id;
+    int virtual;
 } fcgid_wrapper_conf;
 
 typedef struct {
@@ -200,7 +201,7 @@
 apr_array_header_t *get_pass_headers(request_rec * r);
 
 const char *set_wrapper_config(cmd_parms * cmd, void *dummy,
-                               const char *wrapper, const char *extension);
+                               const char *wrapper, const char *extension, const char* virtual);
 fcgid_wrapper_conf *get_wrapper_info(const char *cgipath, request_rec * r);
 
 const char *set_authenticator_info(cmd_parms * cmd, void *config,

Modified: httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c?rev=814017&r1=814016&r2=814017&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/mod_fcgid.c Fri Sep 11 20:32:05 2009
@@ -163,8 +163,19 @@
     e_info.next = NULL;
     p = r->main ? r->main->pool : r->pool;
 
+    wrapper_conf = get_wrapper_info(r->filename, r);
+
+    /* Check for existence of requested file, unless we use a virtual wrapper. */
+    if (wrapper_conf == NULL || !wrapper_conf->virtual) {
+        if (r->finfo.filetype == 0)
+            return HTTP_NOT_FOUND;
+
+        if (r->finfo.filetype == APR_DIR)
+            return HTTP_FORBIDDEN;
+    }
+
     /* Build the command line */
-    if ((wrapper_conf = get_wrapper_info(r->filename, r))) {
+    if (wrapper_conf) {
         if ((rv =
              default_build_command(&command, &argv, r, p,
                                    &e_info)) != APR_SUCCESS) {
@@ -174,12 +185,6 @@
             return HTTP_INTERNAL_SERVER_ERROR;
         }
     } else {
-        if (r->finfo.filetype == 0)
-            return HTTP_NOT_FOUND;
-
-        if (r->finfo.filetype == APR_DIR)
-            return HTTP_FORBIDDEN;
-
         if ((rv = cgi_build_command(&command, &argv, r, p,
                                     &e_info)) != APR_SUCCESS) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
@@ -647,9 +652,9 @@
                    "an environment variable name and optional value to pass to FastCGI."),
     AP_INIT_TAKE1("PassHeader", add_pass_headers, NULL, RSRC_CONF,
                   "Header name which will be passed to FastCGI as environment variable."),
-    AP_INIT_TAKE12("FCGIWrapper", set_wrapper_config, NULL,
+    AP_INIT_TAKE123("FCGIWrapper", set_wrapper_config, NULL,
                    RSRC_CONF | ACCESS_CONF | OR_FILEINFO,
-                   "The CGI wrapper file and an optional URL suffix"),
+                   "The CGI wrapper file an optional URL suffix and an optional flag"),
     AP_INIT_TAKE1("PHP_Fix_Pathinfo_Enable",
                   set_php_fix_pathinfo_enable,
                   NULL, RSRC_CONF,